I hope that you can help me with this one. It might have been asked multiple times already (I know that), but for some reason, I just can't have it working.
I want to move some files from the "files" directory to the root directory.
So the files are, for example:
test1.txt test2.txt test3.zip test4.zip test5.exe test6.exe
I want these files to be moved to different directories.
So I'm using something like this:
move files\*.txt ..\txt /q
move files\*.zip ..\zip /q
move files\*.exe ..\exe /q
But I always get errors. It can't find the files and then the CMD stops working.
Thanks.
EDIT:
It's working like this:
move /y .\files\*.txt ..\txt
move /y .\files\*.zip ..\zip
move /y .\files\*.exe ..\exe
But now it won't move the file to the parent directory.
You can automatically move files from one folder to another by using a script that uses Robocopy, a command-line utility which comes with Windows 10. To automated file transfer, you need to use Robocopy script, add frequency in days, source and destination folder paths.
Highlight the files you want to move. Press the keyboard shortcut Command + C . Move to the location you want to move the files and press Option + Command + V to move the files.
/q isn't a valid parameter. /y: Suppresses prompting to confirm overwriting
Also ..\txt means directory txt under the parent directory, not the root directory. The root directory would be: \ And please mention the error you get
Try:
move files\*.txt \
Edit: Try:
move \files\*.txt \
Edit 2:
move C:\files\*.txt C:\txt
Suppose there's a file test.txt
in Root Folder, and want to move it to \TxtFolder
,
You can try
move %~dp0\test.txt %~dp0\TxtFolder
.
reference answer: relative path in BAT script
Try:
move "C:\files\*.txt" "C:\txt"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With