Hola a todos quiero pasar archivos con una determinada extensión a una carpeta dentro del mismo directorio
el directorio es archivo y dentro de el una carpeta "TEMP"
lo que quisiera es hacer move file *.xml a la carpeta TEMP
Es factible
Disculpen la simpleza pero no lo pude resolver
Luis
Mover grupo de archivos
- Antonio Linares
- Site Admin
- Posts: 44515
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Mover grupo de archivos
Estimado Luis,
Mira a ver si te sirve asi:
Mira a ver si te sirve asi:
Code: Select all | Expand
PROCEDURE MoverXML()
LOCAL aFiles := Directory( "archivo\*.xml" )
LOCAL aFile
FOR EACH aFile IN aFiles
FRename( "archivo\" + aFile[1], "archivo\TEMP\" + aFile[1] )
NEXT
? Len(aFiles), "archivos movidos"
RETURN
Re: Mover grupo de archivos
Si el origen y el destino están en unidades diferentes o en un recurso compartido de red (ruta UNC), `FRename()` suele fallar. En ese caso, hazlo de forma robusta copiando y luego eliminando el archivo (Copy + Delete).
-
cpheraclio
- Posts: 26
- Joined: Thu Mar 17, 2022 6:47 pm
Re: Mover grupo de archivos
FileMove()
Moves a file to another directory.
Syntax
FileMove( <cSourceFile>, <cTargetFile> ) --> nErrorCode
Arguments
<cSourceFile>
This is a character string holding the name of the file to move. It must include path and file extension. The path can be omitted from <cSourceFile> when the file resides in the current directory.
<cTargetFile>
This is a character string with the new file name including file extension. Drive and/or path are optional. Return
The function returns zero on success or a numeric error code on failure.
Description
The function moves <cSourceFile> to a file specified with <cTargetFile>. The target file must be on the same drive as the source file.
Moves a file to another directory.
Syntax
FileMove( <cSourceFile>, <cTargetFile> ) --> nErrorCode
Arguments
<cSourceFile>
This is a character string holding the name of the file to move. It must include path and file extension. The path can be omitted from <cSourceFile> when the file resides in the current directory.
<cTargetFile>
This is a character string with the new file name including file extension. Drive and/or path are optional. Return
The function returns zero on success or a numeric error code on failure.
Description
The function moves <cSourceFile> to a file specified with <cTargetFile>. The target file must be on the same drive as the source file.
Re: Mover grupo de archivos
Gracias Antonio funcionó perfecto. También agradeco a Otto y a cpheraclio por haber contribuído con otras soluciones.
Luis
Luis