hendrkle
asked on
Batch to move files and folders
Dear Experts,
Today, and each Friday, I need to clean out my desktop files and folders which have filled my two 22inch screens since Monday. I use the desktop as a bit of a temp folder.
I was wondering if its possible to create a batch script which does the following;
1) Create a folder on the desktop named "Desktop BU" (but don't if it already exists)
2) Create a sub-folder in the Desktop BU folder which is named with a date stamp, in example "BU 18 Feb 2011" (or any other date format) (but don't if it already exists)
2) Move all files and folders (including all sub-folders and files) from the desktop to the folder created in step two (or the folder that already had that date stamp)
2A) Do not move certain Files, Folders, or Shortcuts. I can specify these as they will always be the same.
No rush with this one but much appreciated, by myself and undoubtedly many colleagues.
Thanks!
Today, and each Friday, I need to clean out my desktop files and folders which have filled my two 22inch screens since Monday. I use the desktop as a bit of a temp folder.
I was wondering if its possible to create a batch script which does the following;
1) Create a folder on the desktop named "Desktop BU" (but don't if it already exists)
2) Create a sub-folder in the Desktop BU folder which is named with a date stamp, in example "BU 18 Feb 2011" (or any other date format) (but don't if it already exists)
2) Move all files and folders (including all sub-folders and files) from the desktop to the folder created in step two (or the folder that already had that date stamp)
2A) Do not move certain Files, Folders, or Shortcuts. I can specify these as they will always be the same.
No rush with this one but much appreciated, by myself and undoubtedly many colleagues.
Thanks!
Replace please text BE2010 with \Desktop BU\. I forgott change it from my testing environment.
If you would like to do also point 2A, send me please what files, folders or shortcuts you need to exclude
and I will change the code.
and I will change the code.
ASKER
Thanks Tominov,
I would like to keep:
Recycle Bin
Shortcuts:
Snagit 9
Mindjet MindManager Pro 6
VLC Media Player
VMware Workstation
Yahoo! Messenger
Cisco VPN
LiveMeeting
O Drive
Excel
PowerPoint
Word
Access
RADAR CRM
Java Web Start
Folders:
Bin
That's it
thank you sir!
I would like to keep:
Recycle Bin
Shortcuts:
Snagit 9
Mindjet MindManager Pro 6
VLC Media Player
VMware Workstation
Yahoo! Messenger
Cisco VPN
LiveMeeting
O Drive
Excel
PowerPoint
Word
Access
RADAR CRM
Java Web Start
Folders:
Bin
That's it
thank you sir!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Managed to do this myself at home - apologies for the late reply, thank you Tominov!
All other files is moved:
For /F "tokens=2 delims= " %%A in ('Date /t') do (SET CurrentDate=%%A)
mkdir "%USERPROFILE%\Desktop\Des
dir %USERPROFILE%\Desktop\ /S /B | find "BE2010" > %TEMP%\FileList.txt
For /F %%A in (%TEMP%\FileList.txt) do move %%A "%USERPROFILE%\Desktop\Des
del %TEMP%\FileList.txt