Hello,
Do we have any alternative ways to delete images without using delete command?
I am trying to copy images from one folder to another.
I just want to copy images which starts with lastname,firstname-idnum.
I want to remove images which starts with hyphen (-)
I want to remove images which starts with numbers
I don't want to use del command on my production environment, so I am looking for safe and better solution.
Would you please give me appropriate solution for that asap?
I am also sharing my code with you but for some reason it is not working properly.
@echo off
robocopy c:\images c:\images2 /XN /XC /XO
cd c:\images2
del /r \ -*.JPG
cd c:\images2
del /r \ [0]*.JPG
cd c:\images2
del /r \ [0]*.JPG
cd c:\images2
del /r \ [1]*.JPG
cd c:\images2
del /r \ [2]*.JPG
cd c:\images2
del /r \ [3]*.JPG
cd c:\images2
del /r \ [4]*.JPG
Thanks
alternative solution to use del command
Moderator: DosItHelp
Re: alternative solution to use del command
Huh
You say you don't want to use the DEL command, but your code uses the DEL command.
Your code cannot work because the /R switch is not valid for the DEL command. But I have no idea what you expected /R to do, so I can't suggest a fix.
What don't you like about DEL What do you mean by "safe and better solution"
No one can help you until you describe the DEL behavior you are trying to avoid, and what exact behavior you want.
Dave Benham
You say you don't want to use the DEL command, but your code uses the DEL command.
Your code cannot work because the /R switch is not valid for the DEL command. But I have no idea what you expected /R to do, so I can't suggest a fix.
What don't you like about DEL What do you mean by "safe and better solution"
No one can help you until you describe the DEL behavior you are trying to avoid, and what exact behavior you want.
Dave Benham
Re: alternative solution to use del command
If you were to use the /XF option with RoboCopy, and potentially couple it with /L, you could effectively be sure you're not copying files over in the first instance. There would then be no need to Delete the copied files you didn't need to copy.