Source language: Translate to:

%userprofile% copy folders

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

%userprofile% copy folders

Postby stevec » Thu Jul 28, 2011 7:49 am

Is there a way to copy a users folder to another drive?

example;

xCopy /s /I /Y /Q "%userprofile%\desktop\*.*" "H:\profile\desktop\" /Exclude:C:\Exclude.txt

Thanks;
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Postby Neosoft Support » Thu Jul 28, 2011 10:22 am

You could probably use the Run action to execute XCopy or a batch file containing XCopy.

Another option would be to use the NeoBookFM/FTP plug-in:

http://www.neosoftware.com/fmftp.html
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby stevec » Thu Jul 28, 2011 12:18 pm

I tried to use the xcopy, but the way I was doing it wasn't working.

The batch file is like this

xCopy /s /I /Y /Q "%userprofile%\desktop\*.*" "H:\profile\desktop\"

The 'run' command I have tried is

Run "xcopy" " /s /I /Y /Q [#34]%userprofile%\desktop\*.*[#34] [#34]H:\profile\desktop\[#34]" "RunOnce+Wait" "" ""

However it fails.
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Postby aguilar955 » Thu Jul 28, 2011 3:19 pm

stevec wrote:I tried to use the xcopy, but the way I was doing it wasn't working.

The batch file is like this

xCopy /s /I /Y /Q "%userprofile%\desktop\*.*" "H:\profile\desktop"

The 'run' command I have tried is

Run "xcopy" " /s /I /Y /Q [#34]%userprofile%\desktop\*.*[#34] [#34]H:\profile\desktop\[#34]" "RunOnce+Wait" "" ""

However it fails.


Neoboduble de David Esperalta

Code: Select all
SystemInfo "%userprofile%" "[userprofile]"
FolderExists "[userprofile]desktop" "[existe]"
If "[existe]" "=" "True"
    npCopiarCarpeta "[userprofile]desktop" "!H:\profile\desktop" "True"
    If "[npResultadoAccion]" "=" "True"
        .ok
    Else
        AlertBox "Error" "[npUltimoError] "
    EndIf
Else
EndIf


https://sites.google.com/site/pluginsne ... -1.0.6.zip

Simple BackUp Utility.
Version 1.02, Freeware

SBU works from the command line. The most handy way of using of it is a .bat file.


Using:

SBU /FROM:<directory> /TO:<directory> [parameters]


Parameters (case-insensitive):

/FILES:<file or wildcards>
Included files or masks, multiple strings are allowed
/EX:<file or wildcards>
Excluded files or masks, multiple strings are allowed
/UPDATE
Copies new or changed files, deletes non-existent files.
/COPYONLY
Copies new or changed files only.
/DELONLY
Deletes non-existent files only.
/COPYALL
Copies all files, deletes non-existent files.
/R
Recurse subdirectories.
/QUIET
Quiet mode.
/H or /?
This help.

Example:

SBU.EXE /FROM:C:\Source /TO:Z:\Source /EX:*.obj /EX:*.tmp /EX:*.dcu /EX:*.bak /EX:*.~* /R /UPDATE


Feedback:

Copyright (c) Sergey Chehuta, 2002
Email: support@whitetown.com
WWW: http://www.whitetown.com

Code: Select all
http://www.multiupload.com/MZALV2MKHA


Code: Select all
Run "cmd" "/c SBU /FROM:[deviceunit]\ /TO:[#34][pctodirectory]\[folder][#34] [parameters]>LogSbu" "Wait+Hidden" "" ""


Salu2
aguilar955
 
Posts: 85
Joined: Sat Jan 17, 2009 10:50 am

Many thanks

Postby stevec » Thu Jul 28, 2011 3:55 pm

wow
many thanks!!!!!!
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Postby dec » Thu Jul 28, 2011 6:01 pm

Hi,

If you like also can download last updated npUtil plugin, wich include the new "npFileOperation" action, a wrapper for the SHFileOperation Windows Shell function, that allow you to "Copies, moves, renames, or deletes a file system object". Although NeoDouble plugin mentioned action is based in "ShFileOperation" too, npUtil plugin allow you to specify much more options, and allow you to make more things, for example, copies various files and folders at a time, specifiying their paths, not "wilcards" like NeoDouble plugin. In the action help you can found more information. Bellow is an image shot of the "npFileOperation" action properties dialog.

Image
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Postby stevec » Thu Jul 28, 2011 6:14 pm

Thanks, I'll try it
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Postby stevec » Fri Jul 29, 2011 6:47 am

Thanks for the code.

I added a \ between the [userprofile] and the folder and it works like a charm!!!!!! :D :D :D :D

SystemInfo "%userprofile%" "[userprofile]"
FolderExists "[userprofile]\desktop\" "[existe]"
If "[existe]" "=" "True"
npCopiarCarpeta "[userprofile]\desktop\*.*" "H:\profile\desktop\" "True"
If "[npResultadoAccion]" "=" "True"
.ok
Else
AlertBox "Error" "[npUltimoError] "
EndIf
Else
EndIf
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Postby aguilar955 » Fri Jul 29, 2011 7:31 am

stevec

Copy the folder and its contents using the plugin Neobouble may fail if the antivirus eg not copy the file blocks neither this nor the following missing for copying .
For example when the Avira blocks external drives autorun.inf

It would be better to use a method of copying file by file.

Copying files without using external plugins or utilities .

Using the command dir to list the files and folders.


http://www.computerhope.com/dirhlp.htm

Code: Select all
SetVar "[origin]" "E:\"
SetVar "[CurrentDir]" "[origin]"
DOSCommand "cmd" "/c Dir /b/o/s > [#34][PubDir]ListofFilesandDirectories.log[#34]" "Wait+Hidden"

FileLen "[PubDir]ListofFilesandDirectories.log" "[longitude]"
Loop "1" "[longitude]" "[which]"
    FileRead "[PubDir]ListofFilesandDirectories.log" "[which]" "[var1]"
    FileExists "[var1]" "[there]"
    If "[there]" "=" "True"
    Else
        StrReplace "[var1]" "[origin]" "" "[var2]" ""
        StrReplace "[PubDir]backup\[var2]" "\\" "\" "[var3]" ""
        FolderExists "[var3]" "[there]"
        If "[there]" "=" "False"
            CreateFolder "[var3]"
            If "[LastError]" ">" ""
                AlertBox "Error" "[LastError]"
            EndIf
        Else
        EndIf
    EndIf
EndLoop

FileLen "[PubDir]ListofFilesandDirectories.log" "[longitude]"
Loop "1" "[longitude]" "[which]"
    FileRead "[PubDir]ListofFilesandDirectories.log" "[which]" "[var1]"
    FileExists "[var1]" "[there]"
    If "[there]" "=" "True"
        StrReplace "[var1]" "[origin]" "" "[var2]" ""
        StrReplace "[PubDir]backup\[var2]" "\\" "\" "[var3]" ""
        FileExists "[var3]" "[there]"
        If "[there]" "=" "False"
            FileCopy "[var1]" "[var3]"
            If "[LastError]" ">" ""
                AlertBox "Error" "[LastError]"
            EndIf
        Else
        EndIf
    Else
    EndIf
EndLoop

FileErase "[PubDir]ListofFilesandDirectories.log"



Code: Select all
SystemInfo "%userprofile%" "[userprofile]"
SetVar "[origin]" "[userprofile]\desktop\"
SetVar "[destination]" "!H:\profile\desktop\"

SetVar "[CurrentDir]" "[origin]"
DOSCommand "cmd" "/c Dir /b/o/s > [#34][PubDir]ListofFilesandDirectories.log[#34]" "Wait+Hidden"


FileLen "[PubDir]ListofFilesandDirectories.log" "[longitude]"
Loop "1" "[longitude]" "[which]"
    FileRead "[PubDir]ListofFilesandDirectories.log" "[which]" "[var1]"
    FileExists "[var1]" "[there]"
    If "[there]" "=" "True"
    Else
        StrReplace "[var1]" "[origin]" "" "[var2]" ""
        StrReplace "[destination][var2]" "\\" "\" "[var3]" ""
        FolderExists "[var3]" "[there]"
        If "[there]" "=" "False"
            CreateFolder "[var3]"
            If "[LastError]" ">" ""
                AlertBox "Error" "[LastError]"
            EndIf
        Else
        EndIf
    EndIf
EndLoop

FileLen "[PubDir]ListofFilesandDirectories.log" "[longitude]"
Loop "1" "[longitude]" "[which]"
    FileRead "[PubDir]ListofFilesandDirectories.log" "[which]" "[var1]"
    FileExists "[var1]" "[there]"
    If "[there]" "=" "True"
        StrReplace "[var1]" "[origin]" "" "[var2]" ""
        StrReplace "[destination][var2]" "\\" "\" "[var3]" ""
        FileExists "[var3]" "[there]"
        If "[there]" "=" "False"
            FileCopy "[var1]" "[var3]"
            If "[LastError]" ">" ""
                AlertBox "Error" "[LastError]"
            EndIf
        Else
        EndIf
    Else
    EndIf
EndLoop

FileErase "[PubDir]ListofFilesandDirectories.log"
Exit "" ""


Copying files without using external plugins or utilities .

Using Windows XCOPY to copy all files.

Just know if an error occurred at the end of the process.


Code: Select all
SystemInfo "%userprofile%" "[userprofile]"
FolderExists "[userprofile]\desktop" "[existe]"
If "[existe]" "=" "True"
Run "cmd" "/c XCOPY [#34][userprofile]\desktop[#34] [#34]!H:\profile\desktop\[#34] /E /I > log.log" "Wait+Hidden" "" ""
Else
EndIf


Salu2
aguilar955
 
Posts: 85
Joined: Sat Jan 17, 2009 10:50 am

thanks

Postby stevec » Fri Aug 12, 2011 11:20 am

Thanks for the code and advise.
Sorry it took so long to recheck the posting.
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest