Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Problem with DEL /S+n

Jul
177
1
Folks,

This might be a misunderstanding on my part, but based on the help for DEL and previous experience with GLOBAL, I expected this command:

Code:
*DEL /s+1 /x /z /q g:\Daily_backups\2012-04-19\definitelynotthere.anywhere

to be the equivalent of

Code:
*DEL /s /x /z /q g:\Daily_backups\2012-04-19\definitelynotthere.anywhere

but that the former wouldn't delete the 2012-04-19 directory if it finished up empty. However, the first command does nothing (as far as I can tell) to a structure with three sub-directories (and no files) in 2012-04-19, all of which have further subdirectories (but no files) of their own (to several levels) but only one of which has any files in those subdirectory structures. The second command performs as expected, deleting all empty subdirectories and leaving just the single subdirectory that contains files lower down the structure. Am I misinterpreting what /s+1 should be doing, or is this a bug??

TCC 12.11.76 x64 Windows 7 [Version 6.1.7601]
TCC Build 76 Windows 7 Build 7601 Service Pack 1
 
It occurs to me that I was being lazy in not supplying more detail, so the following session log gives a better feel for that I'm trying to get at. The end result that I'm trying to achieve is a command that will leave the test_4 directory intact whilst removing all of the subdirectories (in the real world, this situation applies to a daily backup process and I'd like to retain the dated top-level directory even if no data was backed up). In the tests below /s+1 achieves nothing, whilst /s gives the desired result for the test_3 directory (where one subdirectory is kept) but not for test_4:

Code:
G:\Daily_backups>copy /[d18-4-12,18-4-12] /s /a: "c:\Users\jacqueline\Documents\My Games\Skyrim"\ test_3\jacqueline\skyrim_saves
C:\Users\jacqueline\Documents\My Games\Skyrim\RendererInfo.txt => G:\Daily_backups\test_3\jacqueline\skyrim_saves\RendererInfo.txt
C:\Users\jacqueline\Documents\My Games\Skyrim\SkyrimPrefs.ini => G:\Daily_backups\test_3\jacqueline\skyrim_saves\SkyrimPrefs.ini
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\autosave1.ess => G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\autosave1.ess
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\autosave1.ess.bak => G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\autosave1.ess.bak
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\autosave2.ess => G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\autosave2.ess
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\autosave2.ess.bak => G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\autosave2.ess.bak
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\autosave3.ess => G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\autosave3.ess
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\autosave3.ess.bak => G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\autosave3.ess.bak
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\quicksave.ess => G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\quicksave.ess
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\quicksave.ess.bak => G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\quicksave.ess.bak
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\Save 288 - Jacqueline Skyrim 180.18.48.ess => G:\Daily_backups\test_3\jacqueline\skyrim_saves\Sa
ves\Save 288 - Jacqueline Skyrim 180.18.48.ess
C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\Save 289 - Jacqueline High Hrothgar 182.16.08.ess => G:\Daily_backups\test_3\jacqueline\skyrim_s
aves\Saves\Save 289 - Jacqueline High Hrothgar 182.16.08.ess
12 files copied
 
G:\Daily_backups>copy /[d18-4-12,18-4-12] /s /a: "c:\Users\darrell\Documents\My Games\Skyrim"\ test_3\darrell\skyrim_saves
TCC: (Sys) There are no more files.
"C:\Users\darrell\Documents\My Games\Skyrim\*"
TCC: (Sys) There are no more files.
"C:\Users\darrell\Documents\My Games\Skyrim\Saves\*"
0 files copied
 
G:\Daily_backups>copy /[d18-4-12,18-4-12] /s /a: "c:\Users\steve\Documents\My Games\Skyrim"\ test_3\steve\skyrim_saves
TCC: (Sys) There are no more files.
"C:\Users\steve\Documents\My Games\Skyrim\*"
TCC: (Sys) There are no more files.
"C:\Users\steve\Documents\My Games\Skyrim\Saves\*"
TCC: (Sys) There are no more files.
"C:\Users\steve\Documents\My Games\Skyrim\Saves.false_start\*"
TCC: (Sys) There are no more files.
"C:\Users\steve\Documents\My Games\Skyrim\Saves.j\*"
0 files copied
 
G:\Daily_backups>dir test_3\ /s /m /h
 
Volume in drive G is Nemesis_Backups Serial number is d398:6780
Directory of G:\Daily_backups\test_3\*
 
19/04/2012 23:16 <DIR> darrell
19/04/2012 23:16 <DIR> jacqueline
19/04/2012 23:16 <DIR> steve
 
Directory of G:\Daily_backups\test_3\darrell\*
 
19/04/2012 23:16 <DIR> skyrim_saves
 
Directory of G:\Daily_backups\test_3\darrell\skyrim_saves\*
 
19/04/2012 23:16 <DIR> Saves
 
Directory of G:\Daily_backups\test_3\jacqueline\*
 
19/04/2012 23:16 <DIR> skyrim_saves
 
Directory of G:\Daily_backups\test_3\jacqueline\skyrim_saves\*
 
19/04/2012 23:16 <DIR> Saves
18/04/2012 20:09 736 RendererInfo.txt
18/04/2012 20:09 3,660 SkyrimPrefs.ini
 
Directory of G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\*
 
18/04/2012 20:01 12,221,352 autosave1.ess
18/04/2012 19:57 12,225,077 autosave1.ess.bak
18/04/2012 20:08 12,250,563 autosave2.ess
18/04/2012 19:59 12,271,478 autosave2.ess.bak
18/04/2012 20:08 12,201,367 autosave3.ess
18/04/2012 19:59 12,213,838 autosave3.ess.bak
18/04/2012 20:07 12,246,327 quicksave.ess
18/04/2012 19:46 12,284,468 quicksave.ess.bak
18/04/2012 16:18 12,428,089 Save 288 - Jacqueline Skyrim 180.18.48.ess
18/04/2012 20:09 12,214,334 Save 289 - Jacqueline High Hrothgar 182.16.08.ess
 
Directory of G:\Daily_backups\test_3\steve\*
 
19/04/2012 23:16 <DIR> skyrim_saves
 
Directory of G:\Daily_backups\test_3\steve\skyrim_saves\*
 
19/04/2012 23:16 <DIR> Saves
19/04/2012 23:16 <DIR> Saves.false_start
19/04/2012 23:16 <DIR> Saves.j
 
G:\Daily_backups>*DEL /s+1 /x /z test_3\definitelynotthere.anywhere
TCC: (Sys) The directory is not empty.
"G:\Daily_backups\test_3"
0 files deleted
 
G:\Daily_backups>cd test_3\
 
G:\Daily_backups\test_3>*DEL /s+1 /x /z definitelynotthere.anywhere
0 files deleted
 
G:\Daily_backups\test_3>cd ..
 
G:\Daily_backups>*DEL /s /x /z test_3\definitelynotthere.anywhere
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\darrell\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\darrell\skyrim_saves\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\darrell\skyrim_saves\Saves\definitelynotthere.anywhere"
Removing G:\Daily_backups\test_3\darrell\skyrim_saves\Saves\
Removing G:\Daily_backups\test_3\darrell\skyrim_saves\
Removing G:\Daily_backups\test_3\darrell\
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\jacqueline\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\jacqueline\skyrim_saves\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\definitelynotthere.anywhere"
TCC: (Sys) The directory is not empty.
"G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves"
TCC: (Sys) The directory is not empty.
"G:\Daily_backups\test_3\jacqueline\skyrim_saves"
TCC: (Sys) The directory is not empty.
"G:\Daily_backups\test_3\jacqueline"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\steve\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\steve\skyrim_saves\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\steve\skyrim_saves\Saves\definitelynotthere.anywhere"
Removing G:\Daily_backups\test_3\steve\skyrim_saves\Saves\
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\steve\skyrim_saves\Saves.false_start\definitelynotthere.anywhere"
Removing G:\Daily_backups\test_3\steve\skyrim_saves\Saves.false_start\
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_3\steve\skyrim_saves\Saves.j\definitelynotthere.anywhere"
Removing G:\Daily_backups\test_3\steve\skyrim_saves\Saves.j\
Removing G:\Daily_backups\test_3\steve\skyrim_saves\
Removing G:\Daily_backups\test_3\steve\
TCC: (Sys) The directory is not empty.
"G:\Daily_backups\test_3"
0 files deleted
 
G:\Daily_backups>dir test_3\ /s /m /h
 
Volume in drive G is Nemesis_Backups Serial number is d398:6780
Directory of G:\Daily_backups\test_3\*
 
19/04/2012 23:16 <DIR> jacqueline
 
Directory of G:\Daily_backups\test_3\jacqueline\*
 
19/04/2012 23:16 <DIR> skyrim_saves
 
Directory of G:\Daily_backups\test_3\jacqueline\skyrim_saves\*
 
19/04/2012 23:16 <DIR> Saves
18/04/2012 20:09 736 RendererInfo.txt
18/04/2012 20:09 3,660 SkyrimPrefs.ini
 
Directory of G:\Daily_backups\test_3\jacqueline\skyrim_saves\Saves\*
 
18/04/2012 20:01 12,221,352 autosave1.ess
18/04/2012 19:57 12,225,077 autosave1.ess.bak
18/04/2012 20:08 12,250,563 autosave2.ess
18/04/2012 19:59 12,271,478 autosave2.ess.bak
18/04/2012 20:08 12,201,367 autosave3.ess
18/04/2012 19:59 12,213,838 autosave3.ess.bak
18/04/2012 20:07 12,246,327 quicksave.ess
18/04/2012 19:46 12,284,468 quicksave.ess.bak
18/04/2012 16:18 12,428,089 Save 288 - Jacqueline Skyrim 180.18.48.ess
18/04/2012 20:09 12,214,334 Save 289 - Jacqueline High Hrothgar 182.16.08.ess
 
G:\Daily_backups>copy /[d16-4-12,16-4-12] /s /a: "c:\Users\steve\Documents\My Games\Skyrim"\ test_4\steve\skyrim_saves
TCC: (Sys) There are no more files.
"C:\Users\steve\Documents\My Games\Skyrim\*"
TCC: (Sys) There are no more files.
"C:\Users\steve\Documents\My Games\Skyrim\Saves\*"
TCC: (Sys) There are no more files.
"C:\Users\steve\Documents\My Games\Skyrim\Saves.false_start\*"
TCC: (Sys) There are no more files.
"C:\Users\steve\Documents\My Games\Skyrim\Saves.j\*"
0 files copied
 
G:\Daily_backups>copy /[d16-4-12,16-4-12] /s /a: "c:\Users\darrell\Documents\My Games\Skyrim"\ test_4\darrell\skyrim_saves
TCC: (Sys) There are no more files.
"C:\Users\darrell\Documents\My Games\Skyrim\*"
TCC: (Sys) There are no more files.
"C:\Users\darrell\Documents\My Games\Skyrim\Saves\*"
0 files copied
 
G:\Daily_backups>copy /[d16-4-12,16-4-12] /s /a: "c:\Users\jacqueline\Documents\My Games\Skyrim"\ test_4\jacqueline\skyrim_saves
TCC: (Sys) There are no more files.
"C:\Users\jacqueline\Documents\My Games\Skyrim\*"
TCC: (Sys) There are no more files.
"C:\Users\jacqueline\Documents\My Games\Skyrim\Saves\*"
0 files copied
 
G:\Daily_backups>dir test_4\ /s /m /h
 
Volume in drive G is Nemesis_Backups Serial number is d398:6780
Directory of G:\Daily_backups\test_4\*
 
19/04/2012 23:19 <DIR> darrell
19/04/2012 23:19 <DIR> jacqueline
19/04/2012 23:19 <DIR> steve
 
Directory of G:\Daily_backups\test_4\darrell\*
 
19/04/2012 23:19 <DIR> skyrim_saves
 
Directory of G:\Daily_backups\test_4\darrell\skyrim_saves\*
 
19/04/2012 23:19 <DIR> Saves
 
Directory of G:\Daily_backups\test_4\jacqueline\*
 
19/04/2012 23:19 <DIR> skyrim_saves
 
Directory of G:\Daily_backups\test_4\jacqueline\skyrim_saves\*
 
19/04/2012 23:19 <DIR> Saves
 
Directory of G:\Daily_backups\test_4\steve\*
 
19/04/2012 23:19 <DIR> skyrim_saves
 
Directory of G:\Daily_backups\test_4\steve\skyrim_saves\*
 
19/04/2012 23:19 <DIR> Saves
19/04/2012 23:19 <DIR> Saves.false_start
19/04/2012 23:19 <DIR> Saves.j
 
G:\Daily_backups>*DEL /s+1 /x /z test_4\definitelynotthere.anywhere
TCC: (Sys) The directory is not empty.
"G:\Daily_backups\test_4"
0 files deleted
 
G:\Daily_backups>cd test_4\
 
G:\Daily_backups\test_4>*DEL /s+1 /x /z definitelynotthere.anywhere
0 files deleted
 
G:\Daily_backups\test_4>cd ..
 
G:\Daily_backups>*DEL /s /x /z test_4\definitelynotthere.anywhere
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\darrell\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\darrell\skyrim_saves\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\darrell\skyrim_saves\Saves\definitelynotthere.anywhere"
Removing G:\Daily_backups\test_4\darrell\skyrim_saves\Saves\
Removing G:\Daily_backups\test_4\darrell\skyrim_saves\
Removing G:\Daily_backups\test_4\darrell\
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\jacqueline\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\jacqueline\skyrim_saves\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\jacqueline\skyrim_saves\Saves\definitelynotthere.anywhere"
Removing G:\Daily_backups\test_4\jacqueline\skyrim_saves\Saves\
Removing G:\Daily_backups\test_4\jacqueline\skyrim_saves\
Removing G:\Daily_backups\test_4\jacqueline\
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\steve\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\steve\skyrim_saves\definitelynotthere.anywhere"
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\steve\skyrim_saves\Saves\definitelynotthere.anywhere"
Removing G:\Daily_backups\test_4\steve\skyrim_saves\Saves\
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\steve\skyrim_saves\Saves.false_start\definitelynotthere.anywhere"
Removing G:\Daily_backups\test_4\steve\skyrim_saves\Saves.false_start\
TCC: (Sys) The system cannot find the file specified.
"G:\Daily_backups\test_4\steve\skyrim_saves\Saves.j\definitelynotthere.anywhere"
Removing G:\Daily_backups\test_4\steve\skyrim_saves\Saves.j\
Removing G:\Daily_backups\test_4\steve\skyrim_saves\
Removing G:\Daily_backups\test_4\steve\
Removing G:\Daily_backups\test_4\
0 files deleted
 
G:\Daily_backups>dir test_4\ /s /m /h
 
Volume in drive G is Nemesis_Backups Serial number is d398:6780
 
G:\Daily_backups>dir /a:d test*
 
Volume in drive G is Nemesis_Backups Serial number is d398:6780
Directory of G:\Daily_backups\test*
 
18/04/2012 08:10 <DIR> test
19/04/2012 23:09 <DIR> test_1
19/04/2012 23:10 <DIR> test_2
19/04/2012 23:17 <DIR> test_3
0 bytes in 0 files and 4 dirs
101,644,374,016 bytes free
 
G:\Daily_backups>
 
Steve:
The example uses such long file specifications and so many that the important elements get lost in the clutter. Can you post a simpler, easier to visualize example? BTW, using TREE /F gives a much clearer view of the essence of the before and after directory structure (not cluttered by file properties). Also, the range format /[d2012-04-19,+0] is the same range as /[d2012-04-19,2012-04-19], without the need to explicitly repeat the start date.
 
Can you post a simpler, easier to visualize example?
This was the simpler example, since the original problem related to the Documents structures for each of five usernames and involved more than a thousand subdirectories, hence the use of test_3 and test_4 rather than test_1 and test_2 ;)

using TREE /F gives a much clearer view of the essence of the before and after directory structure
Good point. I tried to simplify the DIR output as much as possible but have to admit that I don't think I've ever used TREE. The log below uses TREE and eliminates the COPY commands (which aren't really relevant to this).

the range format /[d2012-04-19,+0] is the same range as /[d2012-04-19,2012-04-19]
Neat, I'd missed that. Let's hope I remember it the next time I need to do something similar (the real world example runs in the early hours of the morning and simply uses a starting date, but in order to simulate the situation I was seeing I needed to limit the COPY to a single day)


Code:
G:\Daily_backups>tree /f test_3\

G:\Daily_backups\test_3\
├──darrell
│ └──skyrim_saves
│ └──Saves
├──jacqueline
│ └──skyrim_saves
│ ├ RendererInfo.txt
│ ├──Saves
│ │ ├ autosave1.ess
│ │ ├ autosave1.ess.bak
│ │ ├ autosave2.ess
│ │ ├ autosave2.ess.bak
│ │ ├ autosave3.ess
│ │ ├ autosave3.ess.bak
│ │ ├ quicksave.ess
│ │ ├ quicksave.ess.bak
│ │ ├ Save 288 - Jacqueline Skyrim 180.18.48.ess
│ │ └ Save 289 - Jacqueline High Hrothgar 182.16.08.ess
│ └ SkyrimPrefs.ini
└──steve
└──skyrim_saves
├──Saves
├──Saves.false_start
└──Saves.j

G:\Daily_backups>*DEL /s+1 /x /z test_3\definitelynotthere.anywhere
TCC: (Sys) The directory is not empty.
"G:\Daily_backups\test_3"
0 files deleted

G:\Daily_backups>cd test_3\

G:\Daily_backups\test_3>*DEL /s+1 /x /z definitelynotthere.anywhere
0 files deleted

G:\Daily_backups\test_3>cd ..

G:\Daily_backups>*DEL /s /x /z /e test_3\definitelynotthere.anywhere
Removing G:\Daily_backups\test_3\darrell\skyrim_saves\Saves\
Removing G:\Daily_backups\test_3\darrell\skyrim_saves\
Removing G:\Daily_backups\test_3\darrell\
Removing G:\Daily_backups\test_3\steve\skyrim_saves\Saves\
Removing G:\Daily_backups\test_3\steve\skyrim_saves\Saves.false_start\
Removing G:\Daily_backups\test_3\steve\skyrim_saves\Saves.j\
Removing G:\Daily_backups\test_3\steve\skyrim_saves\
Removing G:\Daily_backups\test_3\steve\
0 files deleted

G:\Daily_backups>tree /f test_4\

G:\Daily_backups\test_4\
├──darrell
│ └──skyrim_saves
│ └──Saves
├──jacqueline
│ └──skyrim_saves
│ └──Saves
└──steve
└──skyrim_saves
├──Saves
├──Saves.false_start
└──Saves.j

G:\Daily_backups>*DEL /s+1 /x /z test_4\definitelynotthere.anywhere
TCC: (Sys) The directory is not empty.
"G:\Daily_backups\test_4"
0 files deleted

G:\Daily_backups>cd test_4\

G:\Daily_backups\test_4>*DEL /s+1 /x /z definitelynotthere.anywhere
0 files deleted

G:\Daily_backups\test_4>cd ..

G:\Daily_backups>*DEL /s /x /z /e test_4\definitelynotthere.anywhere
Removing G:\Daily_backups\test_4\darrell\skyrim_saves\Saves\
Removing G:\Daily_backups\test_4\darrell\skyrim_saves\
Removing G:\Daily_backups\test_4\darrell\
Removing G:\Daily_backups\test_4\jacqueline\skyrim_saves\Saves\
Removing G:\Daily_backups\test_4\jacqueline\skyrim_saves\
Removing G:\Daily_backups\test_4\jacqueline\
Removing G:\Daily_backups\test_4\steve\skyrim_saves\Saves\
Removing G:\Daily_backups\test_4\steve\skyrim_saves\Saves.false_start\
Removing G:\Daily_backups\test_4\steve\skyrim_saves\Saves.j\
Removing G:\Daily_backups\test_4\steve\skyrim_saves\
Removing G:\Daily_backups\test_4\steve\
Removing G:\Daily_backups\test_4\
0 files deleted

G:\Daily_backups>
 
If I understand your purpose, you daily back up all of the USERPROFILE directory trees. Your backup tree's root apparently has a branch for each user, and each user branch has branches for every day: G:\daily_backups\user\2012-04-19\...; you want to remove all empty subdirectory trees (i.e., trees with no files) but leave the daily directory even if it has no files (presumably as an indication that the user tree was successfully backed up).

If your backup is done using COPY, and you use 4NT version 8, or any TCC version, the command's /F option will not create empty directories (unless you copy from FTP:). If you already created the 2012-04-19 directory, that will remain empty, as you apparently desire.

If my interpolation between the lines of your posts is correct, and you leave the 2012-04-19 directory empty when nothing needed to be backed up for the user as a success marker, I'd probably use a backup log instead of an empty file. If you use TCC v13, the following may help do that:

COPY sets three internal variables:
%_copy_dirs The number of directories created
%_copy_files The number of files copied
%_copy_errors The number of errors

The command below is what I use to eliminate dead branches of directory hierarchies:
*del/q/y/x/s/net/a:d target_directory
which also deletes target_directory if it has no files.
 
Your backup tree's root apparently has a branch for each user, and each user branch has branches for every day: G:\daily_backups\user\2012-04-19\...;
Not exactly (the user and date elements are the other way around) but I don't see that it matters much. I have a COPY command for each user, so...

the command's /F option will not create empty directories
Game shot. I've been using JP Software's command line tools dating back to the late 90s and I'd not noticed that option appear (although I did take a big jump from v7 to v12 on my home machines). You are correct in suggesting that it will resolve the immediate issue, although it might create a few more directories than necessary (because the first two levels for each user are hard-coded into the command).

you leave the 2012-04-19 directory empty when nothing needed to be backed up for the user as a success marker, I'd probably use a backup log instead of an empty file
Good suggestion, but I already keep a log, and the reason for wanting to keep the empty directory is not as a marker of success but to simplify the identification of the start date for the next backup (under normal circumstances it is a moot point as the process runs at least once per day, but things like holidays (or vacations as I believe they are known over the other side of the pond) mean occasional longer gaps) and I chose to do that based on the existence of the directory from the previous backup rather than writing and then reading another file for tracking purposes.

*del/q/y/x/s/net/a:d target_directory
which also deletes target_directory if it has no files.
I've always used something similar but I would still like to hear from Rex whether or not the /s+1 is performing as expected as it seems like a useful option in the context of clearing out a directory that you are going to repopulate and thus where the removal of the top level directory adds an extra step (the recreation of said directory) to the process.
 
If you already keep a log, all you need is to look at its @filedate, without accessing its content, to know when you last backed up, thus eliminating the need to keep empty directories and search for the one with the latest date. The only issue may be that you started to back up near midnight, but finished after midnight, so some users' backup straddles dates. Using Charles Dye's ISO8601 plugin you can use the @filestamp function instead to control what needs to be backed up.

I agree with you last point. It would be nice to have at least a detailed clarification of how /s+n works. Of course, you can work around it, by PUSHD into the directory, clearing the dead wood (i.e., branches without files), and POPD back to the master. But I am sure you already do it your own way.
 
all you need is to look at its @filedate, without accessing its content, to know when you last backed up
There are reasons why that wouldn't have the desired effect, but I won't bore you with the gory details :)

I am sure you already do it your own way
One of the nice things about the product is the number of ways it gives you to 'skin the cat', so yes. FWIW I had simply added an MD for the top-level directory after the DEL, which works fine if a little wastefully. I actually like your idea better, so will adopt that approach.
 
No official word from Rex on this one, so is anyone else able to get DEL /S+n to do anything useful/comprehensible??
 
@Rex, am I misinterpreting what /s+n is designed to do on the DEL command?? Any comment on the behaviour that I'm seeing??
 
This might be a misunderstanding on my part, but based on the help for DEL and previous experience with GLOBAL, I expected this command:

Code:
*DEL /s+1 /x /z /q g:\Daily_backups\2012-04-19\definitelynotthere.anywhere

to be the equivalent of

Code:
*DEL /s /x /z /q g:\Daily_backups\2012-04-19\definitelynotthere.anywhere

but that the former wouldn't delete the 2012-04-19 directory if it finished up empty. However, the first command does nothing (as far as I can tell) to a structure with three sub-directories (and no files) in 2012-04-19, all of which have further subdirectories (but no files) of their own (to several levels) but only one of which has any files in those subdirectory structures. The second command performs as expected, deleting all empty subdirectories and leaving just the single subdirectory that contains files lower down the structure. Am I misinterpreting what /s+1 should be doing, or is this a bug??

TCC 12.11.76 x64 Windows 7 [Version 6.1.7601]

Fixed several months ago in Take Command 13.03.36:

"DEL - Fix for DEL /S+n when target is not a wildcard-only name."
 
Fixed several months ago in Take Command 13.03.36
That's strange 'cos I tried to search the forums for "DEL /S+", failing miserably through the forum search facility (which just complained about the terms being too short or too common) but also finding nothing via a Google search restricted to the forum URIs via the site: keyword. Ah well, playing around just now reveals that if I'd used the base jpsoft.com the search would have found the .aiu file for that update, so mea culpa.
 

Similar threads

Back
Top