Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

Windows Batch & Powershell: avoid running for real & echo & list

Hello experts,

I am trying to document how to avoid running for real and just list the following command (prior to run for real).
  • Robocopy "C:\Source" "C:\Destination" /L rem: Just List files and folder
  • Del: del /q /s /f "C:\FolderName"
  • Rmdir: rmdir "foldername" /q /s
  • Move:move *.filetype %userprofile%\folder
  • Forfiles: ForFiles /p "C:\FolderName" /s /d -30 /c "cmd /c if @isdir == FALSE if /i @ext == \"txt\" del @file"
  • Remove-Item: Remove-Item C:\FolderName\* -recurse -verbose

If you have questions, please contact me.
Thank you for your help.
SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Luis Diaz

ASKER

Thank you very much.
Unable to test it right know.
I will keep you informed.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tested proposals and they work. However I am still having some difficulties with Del command.
When you execute del command you have the message:
Deleted file - "File name"
However when you put echo Del /q /s /f  "C:\FolderName\*.*" you don't have the files involved by the delete.
I supposed that a workaround is to list the various folder through Dir?
Thank you for your help.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Noted. I will test it and keep you informed.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Noted.
Thank you very much for your help and for those useful recommendations!