Link to home
Start Free TrialLog in
Avatar of elburgundi666
elburgundi666

asked on

Script to match and move Files and associated folder

Hello!

     I need some help, I need to be able by scripting to match a file "name.ext " and a folder "name" the description on the "name" is the same on the file and the folder, after I checked that I have the file and the folder on the following path "z:\products" I need to move this to a x:\backup folder.

To be able to monitor the files that have been modev to x:\backup i need to set a number of time that the script checks the files and folders.

Is this possible by script?
Avatar of MSE-dwells
MSE-dwells
Flag of Yemen image

I'm having difficulty understanding what you want, can you give an example please.
Avatar of elburgundi666
elburgundi666

ASKER

i.e. The folder x:\temp have several Subfolders and .DAT files that associated to the sub folder.
-temp
 -name1
 -name1.dat
 -name2
 - name2.dat
 - name3
 - name3.dat

What I'm looking for is to be able to match the "name1.dat" file  to the "name1" and if I have the two of them to move them in to a different folder.

What do you think?
Is the name going to remain the same or similar or based on some known prefix or could it be anything at all?
Hi!

   It can be anything, but it usually shows a 6 to 12 numbers on the name.

Thanks!
So does the following adequately represent the required logic -

1. scan a given directory (not including its subdirectories) for all files
2. remove the extension from the filename and determine if a folder of that name exists in the same directory as the file
3. if so, move both the file and the folder to a different directory
That's correct....
ASKER CERTIFIED SOLUTION
Avatar of MSE-dwells
MSE-dwells
Flag of Yemen image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello!

   How can we do this with all the files and folders on a specific folder?

Thanks!
Forced accept.

Computer101
EE Admin