Copy over files/replace (complete question)

  • Thread starter Thread starter G3£Wh\)zZ@
  • Start date Start date
G

G3£Wh\)zZ@

Cat walked over keyboard and actually sent the previous post uncomplete so
here it is complete..thansk for reading.

I have a lot of files on cd/dvd that i am moving into one folder on my hdd
so i can sort them out before reburning them. However there are quiet a few
mp3 files that have the same name etc but because i converted these at a
higher bit rate they are larger in size, whilst moving them to the folder i
keep getting the "would i like to replace the existing file" and have to
click either yes or no.

Its a pain ...so is there anything out there or anything i can do , that
will only copy/replace the original file if the new file is larger in size..
 
Option Explicit
Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal
lpExistingFileName As String, _
ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long

Public Function APIFileCopy(src As String, dest As String, _
Optional FailIfDestExists As Boolean) As Boolean

'PURPOSE: COPY FILES
'PARAMETERS: src: Source File (FullPath)
'dest: Destination File (FullPath)
'FailIfDestExists (Optional):
'Set to true if you don't want to
'overwrite the destination file if
'it exists

'Returns (True if Successful, false otherwise)

'EXAMPLE:
'dim bSuccess as boolean
'bSuccess = APIFileCopy ("C:\MyFile.txt", "D:\MyFile.txt")

Dim lRet As Long
lRet = CopyFile(src, dest, FailIfDestExists)
APIFileCopy = (lRet > 0)
End Function

Hope this helps.
 
Back
Top