Мы должны сделать проект в колледже, и мы столкнулись с очень большой проблемой, это называют Той же политикой Источника. Amog другие вещи, это делает тот Ваш метод XMLHttpRequest из JavaScript, не может выполнить запросы к доменам кроме домена, что Ваш сайт идет.
, Например, Вы не можете выполнить запрос на www.otherexample.com, если Ваш сайт находится на www.example.com. JSONRequest признает, что, но Вы получите результат в формате JSON, если тот сайт признает что (например, это имеет веб-сервис, который возвращает сообщения в JSON). Это - одна проблема, где Вы могли использовать JSON, возможно.
Вот что-то практическое: Yahoo JSON
Update:
Adjusted code to a. check whether folders already exist at the destination, in which case move files in that folder over (and continue traversing the source directory structure), otherwise move the folder wholesale.
At the end of the script the source folder is removed altogether to eliminate these folders which have had their files moved over to an already existent folder at the destination (meaning these folders have been emptied but not deleted at the source).
Additionally we check whether a folder is both empty and already exists at the destination in which case we do nothing (and leave the source folder to be deleted to the last line of the script). Not doing this results in "The filename, directory name, or volume label syntax is incorrect." errors.
Phew! Please let me know how you get on with this! I have tested this and it seems to be working well.
for /d /r "c:\source" %%i in (*) do if exist "c:\destination\%%~ni" (dir "%%i" | find "0 File(s)" > NUL & if errorlevel 1 move /y "%%i\*.*" "c:\destination\%%~ni") else (move /y "%%i" "c:\destination")
move /y c:\source\*.* c:\destination
rd /s /q c:\source
Поскольку XCOPY работает, вы можете использовать XCOPY и DELETE, это обходной путь, но должно ли работать?
Undoubtedly use robocopy. It is a simple but brilliantly useful tool.
robocopy /move /e sourcedir destdir
This will move all the files and folders, including empty ones, deleting each original file after it has moved it.
If you don't have robocopy installed you can download it by itself or as part of a Microsoft resource kit.
Как отправлено в твиттере: Попробуйте объединить попытку 3 с попыткой 1. Переименуйте, чтобы получить правильную папку назначения, затем переместите «Место назначения» в правильное место.
У меня есть каталог, в котором файлы и несколько уровней подкаталоги:
C: \ Source
Я хотел бы переместить содержимое C: \ Source в:
C: \ Destination
Может быть, я что-то упускаю, но не можете ли вы просто переименовать папку?
on Vista use
robocopy source destination /MIR /MIR .. mirror a complete directory tree (also deletes files in the destination)
else
xcopy
Of course you have to delete the source afterwards :)
@echo on
set SOURCE=C:\Source
set DESTINATION=C:\Destination
xcopy %SOURCE%\* %DESTINATION%\* /s /e /i /Y
PAUSE
Я использую командный файл вроде этого ...
или просто звоню:
xcopy C:\Source\* C:\Destination\* /s /e /i /Y
Я думаю, что самое простое, что вы могли бы сделать, это изменить вашу Попытку 2
с
MOVE "C:\Source" "C:\Destination"
на
MOVE "C:\Source\*" "C:\Destination"
KISS; -)
Изменить : кажется не работать, Так что мой совет - выбросить дрянную командную строку DOS и использовать Cygwin с BASH в качестве оболочки! (или просто добавьте двоичные файлы cygwin в путь, чтобы вы могли использовать mv
в DOS, тем самым не изменяя оболочку в соответствии с вашими требованиями).