Jump to content

Copy files within a Network Drive.. HELP!


Go to solution Solved by swstrau118,

Recommended Posts

I am trying to copy folders from the C drive to a Network Drive and I also have to copy folders and place them in a backup folder  - is this possible? I have the following code but it doesn't appear to be working. Any help would be great!

DirCopy(@DesktopDir & "\TEST", @TempDir & "\MyTempDir", 1)
DirMove(@TempDir & "\MyTempDir", [NETWORKPATH]\Backup - " & @Year & "-" & @MON & "-" & @MDAY & "-" & @MIN &"", 1)
Link to comment
Share on other sites

as your code colouring suggests, you have a syntax error, misuse of double-quotes, and possibly variable issues.

what do you expect [NETWORKPATH] to be? it can't be a real network path.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Hi,

Yes, that is possible.

What exactly do you type in the [NETWORKPATH] ?

What is the code exactly in that line?

Also, you dont need &"" at the end

Here is the code for the [NETWORKPATH]:

DirCopy(@DesktopDir & "\TEST", @TempDir & "\MyTempDir", 1)
DirMove(@TempDir & "\MyTempDir", "P:\TEST\Backup - " & @Year & "-" & @MON & "-" & @MDAY & "-" & @MIN &"", 1)

It does require an authentication as well. 

Edited by swstrau118
Link to comment
Share on other sites

just put another double-quote in front of P:TESTBACKUP, and delete the &"" at the end after @MIN

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

just put another double-quote in front of P:TESTBACKUP, and delete the &"" at the end after @MIN

Great that worked! If I have two folders Test1 and Test2 that I am copying from C drive to the Network drive. If those two files exist is it possible to write an "If" statement to say if this Test1 and Test2 exist - rename the old files (to Test1 - 2013-07-03 or something)  Here is the code I have and I do not receive any errors it just doesn't work.

DirCopy(@DesktopDir & "\TEST", "P:\TEST", 1)
    If FileExists("Test1") AND ("Test2") Then
        FileMove("P:\TEST", "P:\TEST - " & @Year & "-" & @MON & "-" & @MDAY & "-" & @MIN &"", 1)
        EndIf
Link to comment
Share on other sites

use full absolute paths in FileExists(), and the AND condition is like this:

DirCopy(@DesktopDir & "\TEST", "P:\TEST", 1)
If FileExists("P:\Test1") AND FileExists("P:\Test2") Then
    FileMove("P:\TEST", "P:\TEST - " & @Year & "-" & @MON & "-" & @MDAY & "-" & @MIN &"", 1)
EndIf

also, your code will rename P:TEST only if both files exist, "P:Test1" and "P:Test2", it will not touch "P:Test1" or "P:Test2"

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

I tried this code and I was able to get it to rename the Test1 folder name but it renames it as a File not a folder. Also it will not copy any of the data from the C drive, once the folder is "renamed" it seems to loose all of the text files in the previous version of the folder. Here is the code:

DirCopy(@DesktopDir & "\TEST", "P:\TEST", 1)
    If FileExists("P:\TEST\Test1") Then
        FileMove("P:\TEST\Test1", "P:\TEST\Test1 - " & @Year & "-" & @MON & "-" & @MDAY & "-" & @MIN &"", 1)
        EndIf
Link to comment
Share on other sites

now you're on the right track. how about using DirMove instead of FileMove?

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...