Where could one find a Copy with a NoDelete option ?
Thanks
Printable View
Where could one find a Copy with a NoDelete option ?
Thanks
I would say that any intrinsic Windows Copy command would do the trick as opposed to a command like Move, which would delete the old after it copied.
Copy/noDelete *.*
What are you referring to? :confused:
I would like to copy/NoDelete to another folder. For example, Copy/NoDelete cell phone photos to folder on XP-disk drive...only files (photos) that no not exsist.
Is there a copy program that will do this?
Ah ok! Although, I am still confusing about what you mean by "NoDelete", it sound like after you copy the data from the phone it deletes it doing a cut rather than a copy is that correct?
Copy the files, but if the file already exsist, do not copy it
Currently, I have to click on No 100 times...do not copy file.
I have made a program that might help! Do you have VB6 to compile the code or do you want me to upload the exe and send you the link?
I have a VB6 compiler
This might work for you.
vb Code:
Option Explicit Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, _ lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long Private Type SHFILEOPSTRUCT hwnd As Long wFunc As Long pFrom As String pTo As String fFlags As Integer fAnyOperationsAborted As Long hNameMappings As Long lpszProgressTitle As Long ' only used if FOF_SIMPLEPROGRESS, sets dialog title End Type Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long ' Available Operations Private Const FO_COPY = &H2 ' Copy File/Folder Private Const FO_DELETE = &H3 ' Delete File/Folder Private Const FO_MOVE = &H1 ' Move File/Folder Private Const FO_RENAME = &H4 ' Rename File/Folder ' Flags Private Const FOF_ALLOWUNDO = &H40 ' Allow to undo rename, delete ie sends to recycle bin Private Const FOF_FILESONLY = &H80 ' Only allow files Private Const FOF_NOCONFIRMATION = &H10 ' No File Delete or Overwrite Confirmation Dialog Private Const FOF_SILENT = &H4 ' No copy/move dialog Private Const FOF_SIMPLEPROGRESS = &H100 ' Does not display file names Private Const FOF_RENAMEONCOLLISION As Long = &H8 'Rename if there is a file of that name Private Const OF_EXIST As Long = &H4000 Private Const OFS_MAXPATHNAME As Long = 128 Private Const HFILE_ERROR As Long = -1 Private Type OFSTRUCT cBytes As Byte fFixedDisk As Byte nErrCode As Integer Reserved1 As Integer Reserved2 As Integer szPathName(OFS_MAXPATHNAME) As Byte End Type Dim fullpath As String, lngReturn As Long, strReturn As Long, strSource As String, strTarget As String Private Sub VBCopyFiles(ByRef strSource As String, ByRef strTarget As String) Dim op As SHFILEOPSTRUCT, sFilename As String sFilename = Dir(strTarget & "\") Do While sFilename > "" sFilename = Dir() Loop If FileExists(strTarget) = False Then With op .wFunc = FO_COPY ' Set function .pFrom = strSource ' Set current path .pTo = strTarget ' Set new path .fFlags = FOF_SILENT Or FOF_NOCONFIRMATION End With 'Perform operation SHFileOperation op If strSource <> "" Then MsgBox ("Finished copying! Quitting.") Unload Me End If End If End Sub Private Function FileExists(ByVal FName As String) As Boolean 'http://www.vbforums.com/showthread.php?t=349990 Dim lRetVal As Long Dim OfSt As OFSTRUCT lRetVal = OpenFile(FName, OfSt, OF_EXIST) If lRetVal <> HFILE_ERROR Then FileExists = True Else FileExists = False End If End Function Private Sub Command1_Click() VBCopyFiles source, destination End Sub
I was using a form to test the code but it could probably work in a module using sub Main.
For the SubMain just put:
vb Code:
VBCopyFiles source, destination
Instead of using the CommandButton