Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a qustion I hope I can get an answer for.
I have a map structure containg sub directories with old files. I want to to use DoDir but but wnat only the files from the directories bove the old files.
i.e.
Data
- New files
- Old files
How can this be made?
//K
Loop through the directories and check the directory name. Something like this:
sub ScanFolder(Root)
for each SubDirectory in dirlist( Root & '\*' )
if $(SubDirectory) <> 'Old files' then
// do stuff
call ScanFolder(SubDirectory)
end if
next SubDirectory
end sub
Call ScanFolder('D:\Data')
Gysbert is correct, search the forums and you will find several examples like this one (of mine)
Miguel
Hi and thx,
Problem is that my explanation of new and old folder was just a brief descriptin. The new folders has year naminf i.e. 2013, 2014, 2015 and so on and in those folder there may be several different sub folder with different names.
So I need a way where I jusr digg on level down regardles och names.
//K
I'm sorry to say I'm beginning to understand less instead of more. Can you post an example of a directory structure with enough subdirectories to make clear all the conditions that should be applied when checking whether or not a subdirectory should be processed.
Hi,
An example:
Data
- Dir_1
- File_1
- SubDir_1
- File_x
- Dir_2
- File_2
- SubDir_2
- File_y
I want to grab the files in the first level of directories below Data dir. Thus, File_1 & File_2 but not what may be stored in SubDir_1 & SubDir_2 like File_x & File_y.
//K
sub ScanFolder(Root)
for each SubDirectory in dirlist( Root & '\*' )
if $(SubDirectory) <> 'Old files' then
// do stuff
// call ScanFolder(SubDirectory) <-- commented out to prevent recursively diving into the subdirectories
end if
next SubDirectory
end sub
Call ScanFolder('D:\Data');