So requesting some help, I am currently trying to sort out a mess in my google photos. I have downloaded the archive of my google photos and have a bunch of folders with files/photos in them. I am trying to write a batch file to move the files/photos from the folder to the root of this portable drive I am using for the cleanup.
So far I have this:
@echo off
for /f "tokens=*" %%f in ('dir /a:-D /s /b') do move "%%f" .
for /f "tokens=*" %%f in ('dir /a:D /s /b') do rd "%%f"
It works the only problem I have is that potentially there could be photos with the same filename in different folders and I don't want to overwrite.
Is there any parameter I can set on the move command to block the overwrite?
Thanks
Answer
Is there any parameter I can set on the move command to block the overwrite?
You can use the /-Y
switch (Enable confirmation prompt, when overwriting files).
The following trick will answer n
, so the move doesn't happen:
echo n|move /-y "%%f" .
Notes:
This trick only works for a single file, no wildcards
If a file is not moved your following
rd
command will fail with th following error:The directory is not empty.
No comments:
Post a Comment