Page 1 of 1 1
Topic Options
#147620 - 2005-09-12 08:06 PM Delete files by date on first level of subfolder
RyanOfSoCal Offline
Fresh Scripter

Registered: 2005-06-01
Posts: 18
Hi,
I have the following file structure:
Parent\Plant1\2003
\2004
\Plant2\2003
\2004

I have hundreds of plant folders. For some odd reason the files inside the 2003 and 2004 folders are also in its respective plant folder. Our accounting department moves the files to the year folder at year end. The 2005 files are still under the plant folders. What I want to do is create a script that will create a 2005 folder under the plant#, move the 2005 files into it, delete all 2003 and 2004 files that are in the plant# folder. The important part is not to delete the files currently in the 2003 and 2004 folders.

Any help you be greatly appreciated.

Thanks,
Ryan


Top
#147621 - 2005-09-12 08:35 PM Re: Delete files by date on first level of subfolder
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Look at the DIR and MOVE commands in the manual.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#147622 - 2005-09-12 08:38 PM Re: Delete files by date on first level of subfolder
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There is also the DirPlus() UDF.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#147623 - 2005-09-12 09:08 PM Re: Delete files by date on first level of subfolder
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
WORD OF WARNING!

Regardless of what UDF or 3rd party util you use to do this. Make sure you have a good backup, as there is a very good possiblity that the first run won't run as you expected it to and then it will be too late.

Try copying all the data to a TEST location first to verify any script or other method does as you expect.

Might also want to think of using an archiver like RAR if the data is being semi-archived or won't be used for long period of time.

Top
#147624 - 2005-09-12 09:26 PM Re: Delete files by date on first level of subfolder
RyanOfSoCal Offline
Fresh Scripter

Registered: 2005-06-01
Posts: 18
Thank you for all your help. We have nightly backup of the files so we are ready for a full restore if needed. A test location is a good idea even if I can restore.

This is off topic but has anyone used a good mirroring program for Windows XP? I want to mirror my hard drive but don't want to purchase a RAID card. The computer doesn't have a floppy drive so I won't be able to add the RAID driver using the F6 option and making new installation CD with the RAID driver is too much work.

Thanks and sorry about asking a non-kix related question.

Ryan

Top
#147625 - 2005-09-18 06:49 PM Re: Delete files by date on first level of subfolder
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Windows xP supports software-RAID1, whcih can be configured under "Disk Management". I'd not recommend it though. You might be better off separating the OS onto the C:\ drive and all files onto the D:\ drive. Then use ROBOCOPY to make regular backups. Also, make a disk image of the system partition for backup purposes. The alternative is on-board RAID (if MB supports it) or true hardware-RAID via add-in card (will most likely require OS reinstall). BTW, mirroring is for up-time, not backups.
_________________________
There are two types of vessels, submarines and targets.

Top
#147626 - 2005-09-19 01:41 AM Re: Delete files by date on first level of subfolder
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
dirplus() has a subfolder depth option
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.177 seconds in which 0.136 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org