Link to home
Start Free TrialLog in
Avatar of Killack
Killack

asked on

take txt file path recreate path then copy file to destination.

Hi All,

I need a script that can take a txt file with full path information of the file I want to copy. Recreate the folder path on a USB drive then copy the file onto the destination drive.

-------------------------------------------------------------------------------------------------------------------
I start off with a txt file that has the full path of files that I will eventually need to copy.

EXAMPLE STARTING FILE:

c:\my documents\test.txt
d:\example\E1\test.doc
\\testserver\test\test1\test3.ppt

-------------------------------------------------------------------------------------------------------------------
First from this file I need to create the folder path (empty folders with same name as origination path) at the destination location. Sometimes it is straight to the drive letter other times it would be to a folder located on the destination drive.

EXAMPLE DESTINATION DRIVE:

Destination drive is F:

F:\my documents
F:\example\E1
F:\testserver\test\test1

EXAMPLE DESTINATION DRIVE & FOLDER:

Destination is F:\copy

F:\copy\my documents
F:\copy\example\E1
F:\copy\testserver\test\test1

-------------------------------------------------------------------------------------------------------------------
Second I will need to copy the file from the txt file into the new destination file path that was created.

EXAMPLE DESTINATION DRIVE::

F:\my documents\test.txt
F:\example\E1\test.doc
F:\testserver\test\test1\test3.ppt

EXAMPLE DESTINATION DRIVE & FOLDER:

F:\copy\my documents\test.txt
F:\copy\example\E1\test.doc
F:\copy\testserver\test\test1\test3.ppt

-------------------------------------------------------------------------------------------------------------------
NOTES:
It will never be a mix of drive letter and drive letter+folder. It will be one or the other.


I have been knocking this around and all my approaches are flawed in that I am using multiple scripts and steps to complete which makes it imposable to turn over to the person responsible for completing the task so in true good management fashion I get stuck with completing someone else job because the manager wants it to be simplified.

Any ideas or help would be greatly appreciated.

Take care!
Killack
Avatar of Killack
Killack

ASKER

Oh and the file path may exceed 256 characters.

Thanks,
Killack
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia 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