User Tools

Site Tools


multiple_20file_20operations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

multiple_20file_20operations [2018/03/31 13:19]
127.0.0.1 external edit
multiple_20file_20operations [2018/04/17 17:47] (current)
tbest3112 Added syntax highlighting
Line 4: Line 4:
 ==== Initialisation ==== ==== Initialisation ====
 \\  Before using the **SHFileOperation** API incorporate the following declarations in your program:\\ \\  \\  Before using the **SHFileOperation** API incorporate the following declarations in your program:\\ \\ 
 +<code bb4w>
         FO_MOVE = 1         FO_MOVE = 1
         FO_COPY = 2         FO_COPY = 2
Line 17: Line 18:
         FOF_SIMPLEPROGRESS = 256 : REM shfo.fFlags.h&​ = 1         FOF_SIMPLEPROGRESS = 256 : REM shfo.fFlags.h&​ = 1
         FOF_NOCONFIRMMKDIR = 512 : REM shfo.fFlags.h&​ = 2         FOF_NOCONFIRMMKDIR = 512 : REM shfo.fFlags.h&​ = 2
 +</​code>​
 ==== Deleting files ==== ==== Deleting files ====
 \\  To delete one or more files use code similar to the following:​\\ \\  \\  To delete one or more files use code similar to the following:​\\ \\ 
 +<code bb4w>
         DEF PROCdeletefiles(afsp$)         DEF PROCdeletefiles(afsp$)
         LOCAL shfo{}         LOCAL shfo{}
Line 29: Line 32:
         SYS "​SHFileOperation",​ shfo{}         SYS "​SHFileOperation",​ shfo{}
         ENDPROC         ENDPROC
 +</​code>​
 As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen '​silently'​ initialise the **fFlags** member as follows:\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen '​silently'​ initialise the **fFlags** member as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l&​ = FOF_SILENT OR FOF_NOCONFIRMATION         shfo.fFlags.l&​ = FOF_SILENT OR FOF_NOCONFIRMATION
         shfo.fFlags.h&​ = 0         shfo.fFlags.h&​ = 0
 +</​code>​
 You can specify that the files are moved to the Recycle Bin rather than permanently deleted as follows:\\ \\  You can specify that the files are moved to the Recycle Bin rather than permanently deleted as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l&​ = FOF_ALLOWUNDO OR FOF_NOCONFIRMATION         shfo.fFlags.l&​ = FOF_ALLOWUNDO OR FOF_NOCONFIRMATION
         shfo.fFlags.h&​ = 0         shfo.fFlags.h&​ = 0
 +</​code>​
 \\  \\ 
 ==== Copying files ==== ==== Copying files ====
 \\  To copy one or more files use code similar to the following:​\\ \\  \\  To copy one or more files use code similar to the following:​\\ \\ 
 +<code bb4w>
         DEF PROCcopyfiles(from$,​dest$)         DEF PROCcopyfiles(from$,​dest$)
         LOCAL shfo{}         LOCAL shfo{}
Line 50: Line 59:
         SYS "​SHFileOperation",​ shfo{}         SYS "​SHFileOperation",​ shfo{}
         ENDPROC         ENDPROC
 +</​code>​
 The **from$** parameter should contain one or more path/​filenames separated by NULs (CHR$0); the filenames may include wildcard characters (? or *). The **dest$** parameter should contain the path to the destination folder to which you want the files to be copied; this folder will be created if necessary.\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen '​silently'​ initialise the **fFlags** member as follows:\\ \\  The **from$** parameter should contain one or more path/​filenames separated by NULs (CHR$0); the filenames may include wildcard characters (? or *). The **dest$** parameter should contain the path to the destination folder to which you want the files to be copied; this folder will be created if necessary.\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen '​silently'​ initialise the **fFlags** member as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l&​ = FOF_SILENT OR FOF_NOCONFIRMATION         shfo.fFlags.l&​ = FOF_SILENT OR FOF_NOCONFIRMATION
         shfo.fFlags.h&​ = FOF_NOCONFIRMMKDIR DIV 256         shfo.fFlags.h&​ = FOF_NOCONFIRMMKDIR DIV 256
 +</​code>​
 If you want to copy only files, rather than any subdirectories included in the **from$** specification,​ add the "​FOF_FILESONLY"​ flag.\\ \\  If you want to copy only files, rather than any subdirectories included in the **from$** specification,​ add the "​FOF_FILESONLY"​ flag.\\ \\ 
 ==== Moving files ==== ==== Moving files ====
 \\  To move (or rename) one or more files use code similar to the following:​\\ \\  \\  To move (or rename) one or more files use code similar to the following:​\\ \\ 
 +<code bb4w>
         DEF PROCmovefiles(from$,​dest$)         DEF PROCmovefiles(from$,​dest$)
         LOCAL shfo{}         LOCAL shfo{}
Line 68: Line 81:
         SYS "​SHFileOperation",​ shfo{}         SYS "​SHFileOperation",​ shfo{}
         ENDPROC         ENDPROC
 +</​code>​
 The **from$** parameter should contain one or more path/​filenames separated by NULs (CHR$0); the filenames may include wildcard characters (? or *). The **dest$** parameter should contain the path to the destination folder to which you want the files to be moved; this folder will be created if necessary.\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen '​silently'​ initialise the **fFlags** member as follows:\\ \\  The **from$** parameter should contain one or more path/​filenames separated by NULs (CHR$0); the filenames may include wildcard characters (? or *). The **dest$** parameter should contain the path to the destination folder to which you want the files to be moved; this folder will be created if necessary.\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen '​silently'​ initialise the **fFlags** member as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l&​ = FOF_SILENT OR FOF_NOCONFIRMATION         shfo.fFlags.l&​ = FOF_SILENT OR FOF_NOCONFIRMATION
         shfo.fFlags.h&​ = FOF_NOCONFIRMMKDIR DIV 256         shfo.fFlags.h&​ = FOF_NOCONFIRMMKDIR DIV 256
 +</​code>​
 If you want to move only files, rather than any subdirectories included in the **from$** specification,​ add the "​FOF_FILESONLY"​ flag.\\ \\  If, rather than moving all the files to the same destination folder, you want to move or rename them individually,​ initialise the **fFlags** member as follows:\\ \\  If you want to move only files, rather than any subdirectories included in the **from$** specification,​ add the "​FOF_FILESONLY"​ flag.\\ \\  If, rather than moving all the files to the same destination folder, you want to move or rename them individually,​ initialise the **fFlags** member as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l&​ = FOF_MULTIDESTFILES         shfo.fFlags.l&​ = FOF_MULTIDESTFILES
         shfo.fFlags.h&​ = 0         shfo.fFlags.h&​ = 0
 +</​code>​
 Now the **dest$** parameter must contain the same number of path/​filename specifications as there are in **from$**, separated by NULs (CHR$0). Now the **dest$** parameter must contain the same number of path/​filename specifications as there are in **from$**, separated by NULs (CHR$0).
multiple_20file_20operations.txt ยท Last modified: 2018/04/17 17:47 by tbest3112