liu said:
project a
project a\file1.htm
project a\file2.htm
...
project a\file3.css
project a\file4.js
...
project a\images\file5.jpg
...
project a\Source\file6.fla
project a\Source\file7.fla
....
I'd like to delete everything inside project a including folders
inside except Source folder. Keep everything inside the source folder
no matter what are inside.
project b
same structure but different files.
Do the same for the remaining 200 more projects with the same
structure.
Thanks for the help,
OK, things are getting clearer. Try this:
[01] @echo off
[02] SetLocal EnableDelayedExpansion
[03] set Source=c:\Project
[04] set Target=c:\HoldingFolder
[05] set Action=echo
[06] for /d %%a in ("%Source%*.*") do (
[07] for %%b in ("%%a") do set Name=%%~na
[08] %Action% md "%Target%\!Name!"
[09] %Action% move "%%a\Source" "%Target%\!Name!"
[10] %Action% rd "%%a" /s /q
[11] %Action% move "%Target%\!Name!" C:\
[12] pause
[13] )
Instructions:
1. Copy & paste the code into a batch file of your choice. Remove the line
numbers.
2. The code assumes that your projects are kept in folders called
"c:\Project xxx" where xxx can be any character string. Modify line #3 if
this is not the case.
3. The drive letter used in lines #4 and #11 must be the same as the drive
letter used for Source in line #3.
4. Run the batch file as it is from a Command Prompt and examine its screen
output carefully.
5. If satisfied, modify line #5 to that it reads
set Action=
then run the batch file until it pauses for the first time. Check that it
has done the right thing.
6. If satisfied, remove line #12, then rerun the batch file.
Note: All care and no responsibility taken. You are responsible for backing
up your files before using this program.