Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Map to find old files

Status
Not open for further replies.

ssi6

Programmer
Sep 22, 2006
7
US
I wrote a map a couple of years ago that does a batch file call to do a directory listing on specified folders, determine how old the file is based on the date/time, and report files older than x minutes in an email. The problem is it then requires manual intervention to move those files. I'd like to modify the map to move the files found to a specified holding area but my current map does not obtain the path information. Current map does a DOS DIR listing and then finds files that start with a pre-defined file name (EDI*).

There's got to be a better way using functions to look in these folders and do this.

Any ideas?
 
What version? Do you have GETDIRECTORY, GETFILENAME functions?
This application would be better served by a PERL script, IMO.



BocaBurger
<===========================||////////////////|0
The pen is mightier than the sword, but the sword hurts more!
 
v8.0.1 Map doesn't currently use GETFILENAME or GETDIRECTORY functions.
 
I do something similar with a batch file to ftp files with a certain time stamp.
You need to do the directory listing as a batch file in an input card - the type tree is a bit tricky and depends on the locale of the machine.
You can then run a map passing the file name of the required file to create the file somewhere else and delete the original.
The dir command in the batch file is
dir \\server\folder /O:D /T:C
 
I do have the map doing a directory listing in a batch file. My problem is the output does not contain the path name so I can run the second map and program it to create that file somewhere else and delete the original. My batch file looks something like this:

DIR d:\Merc\temp >> d:\In\dolist.txt
DIR d:\Merc\sx3yhg\in >> d:\In\dolist.txt
DIR d:\Merc\sx4rtv\in_1061 >> d:\In\dolist.txt

I have about 50 directories I'm scanning. I realize the path is in the DIR output but creating a map to parse out the path and then determine IF there are any file names present and concatenate the two together....sounds like there should be a better way.

Thanks for the help.
 
Ok, DIR five you a the path name where the dir was executed and all files and directories at that level....

So, try 'dir/s >>directory_log_file_name.txt"

Sample should give you what you need to dynamically move the files and rename them;E, SIZE, NAME and PATH.....

Volume in drive C is Local Disk
Volume Serial Number is X0D9-41X8

Directory of C:\test_dir

09/23/2006 02:15a <DIR> .
09/23/2006 02:15a <DIR> ..
09/23/2006 02:15a 0 directory_log_file_name.txt
09/23/2006 02:14a <DIR> test_dir1
09/23/2006 02:14a <DIR> test_dir2
1 File(s) 0 bytes

Directory of C:\test_dir\test_dir1

09/23/2006 02:14a <DIR> .
09/23/2006 02:14a <DIR> ..
09/23/2006 02:13a 0 file1.txt
1 File(s) 0 bytes

Directory of C:\test_dir\test_dir2

09/23/2006 02:14a <DIR> .
09/23/2006 02:14a <DIR> ..
09/23/2006 02:13a 0 file1.dat
09/23/2006 02:13a 0 file2.txt
09/23/2006 02:14a <DIR> test_dir3
2 File(s) 0 bytes

Directory of C:\test_dir\test_dir2\test_dir3

09/23/2006 02:14a <DIR> .
09/23/2006 02:14a <DIR> ..
09/23/2006 02:13a 0 other_file.txt
1 File(s) 0 bytes

Total Files Listed:
5 File(s) 0 bytes
11 Dir(s) 6,151,376,896 bytes free
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top