Purpose:Move files to a new directory (and optionally drive)

 

Format:MOVE  [/A:[[-]rhsadecijopt /B /C /CF /D /E /G /H /I"text" /J /K /L /LD /M /MD /N[dejnst] /O /O:[-]adegnrstu /P /Q /R /S[[+]n] /SX /T /U /UF /V /W /Y /Z] [@file] source... destination

 

sourceA file or list of files to move.
destinationThe new location for the files.
@fileA text file containing the names of the source files to move, one per line (see @file lists for details).

 

/A:  (Attribute select)

/O (don't move if target exists)

/B (Move after reboot)

/O:... (Order)

/C(hanged)

/P(rompt)

/CF (changed 2s+ resolution)

/Q(uiet)

/D(irectory)

/R(eplace)

/E  (No error messages)

/S(ubdirectory tree)

/G (display percent copied)

/SX (single target directory)

/H(idden and system)

/T(otal)

/I"text" (match description)

/U(pdate)

/J (copy in restartable mode)

/UF  (updated 2s+ resolution)

/K (delete to recycle bin)

/V(erify)

/L (ASCII FTP transfer)

/W(ipe)

/LD (create link)

/Y (force move of encrypted files)

/M(odified files)

/Z (overwrite)

/MD (Create target directory)


/N (Disable)


 

See  also COPY, DEL and RENAME.

 

File Selection

 

Supports command dialog, attribute switches, extended wildcards, ranges, multiple file names, delayed variable expansion, and include lists. Date, time, size, or file exclusion ranges anywhere on the line apply to all source files. Use wildcards with caution on LFN volumes; see LFN File Searches for details.

 

Internet: Can be used with FTP/TFTP/HTTP/HTTPS Servers.

 

Usage:

 

The MOVE command moves one or more files from one directory to another, whether the directories are on the same drive or not. It has the same effect as copying the files to a new location and then deleting the originals. Like COPY and RENAME, MOVE works with single files, multiple files, and sets of files specified with an include list. If you don't specify any arguments, MOVE will display its command dialog.

 

The simplest MOVE command moves a single source file to a new location and, optionally, gives it a new name. These two examples both move one file from drive C: to the root directory on drive A:

 

[c:\] move myfile.dat a:\

[c:\] move myfile.dat a:\savefile.dat

 

In both cases, MYFILE.DAT is removed from drive C: after it has been copied to drive A:. If a file called MYFILE.DAT in the first example, or SAVEFILE.DAT in the second example, already existed on drive A:, it would be overwritten. (This demonstrates the difference between MOVE and RENAME. MOVE will move files between drives and will overwrite the destination file if it exists; RENAME will not.)

 

When you move a single file, the destination can be a directory name or a file name. If it is a directory name, and you add a backslash [\] to the end of the name, MOVE will display an error message if the name does not refer to an existing directory. You can use this feature to keep MOVE from treating a mistyped destination directory name as a file name, and attempting to move the source file to that name.

 

If you MOVE multiple files, the destination must be a directory name. MOVE will move each file into the destination directory with its original name. If the destination is not a directory, MOVE will display an error message and exit. For example, if C:\FINANCE\MYFILES is not a directory, this command will display an error; otherwise, the files will be moved to that directory:

 

move *.wks *.txt c:\finance\myfiles

 

The /D option can be used for single or multiple file moves; it checks to see whether the destination is a directory, and will prompt to see if you want to create the destination directory if it doesn't exist.

 

If MOVE creates one or more destination directories, they will be added automatically to the extended directory search database; see Extended Directory Searches for details.

 

Be careful when you use MOVE with the SELECT command. If you SELECT multiple files and the destination is not a directory (for example, because of a misspelling), MOVE will assume it is a file name. In this case each file will be moved in turn to the destination file, overwriting the previous file, and then the original will be erased before the next file is moved. At the end of the command, all of the original files will have been erased and only the last file will exist as the destination file.

 

You can avoid this problem by using square brackets with SELECT instead of parentheses (be sure that you don't allow the command line to get too long; watch the character count in the upper left corner while you're selecting files). MOVE will then receive one list of files to move instead of a series of individual filenames, and it will detect the error and halt. You can also add a backslash [\] to the end of the destination name to ensure that it is the name of a subdirectory (see above).

 

When you specify a single subdirectory source and a single subdirectory target, the source directory tree will be moved to a subdirectory of the target directory. If the source is a subdirectory and the target doesn't exist, the target subdirectory will be created and the source tree moved to it. (These are both for compatibility with CMD.)

 

If you specify the /C, /CF, /R, /U, or /UF options, MOVE will append a ! to the move specifier if the target exists and is being overwritten. For example:

 

[d:\]        move file1 file2

file1 ->! file2

 

MOVE sets three internal variables:

 

%_move_dirsThe number of directories created
%_move_filesThe number of files moved
%_move_errorsThe number of errors

 

FTP Usage:

 

You can move files to and from Internet URLs (FTP, TFTP and HTTP). For example:

 

move ftp://ftp.abc.com/f1.txt c:\text\

 

Files moved to or from FTP servers are normally transferred in binary mode. To perform an ASCII transfer use the /L switch. File descriptions are not copied when moving files to an Internet URL.

 

Wildcard characters such as [*] and [?] will be treated as wildcards in FTP URLs, but will be treated as normal characters in HTTP URLs.

 

Note: The /G option (percent moved) may report erratic values during transfer of files larger than 4 Gb (an FTP limitation) and during http downloads.

 

NTFS File Streams:

 

MOVE supports file streams on NTFS drives. You can move an individual stream by specifying the stream name, for example:

 

move streamfile:s1 file2

 

If no stream name is specified the entire file is moved, including all streams. However, if you move a file to a drive or device which does not support streams, only the file's primary data is moved; any additional streams are not processed and their data will be lost.

 

See NTFS File Streams for additional details.

 

Advanced Features and Options

 

If MOVE must physically copy the files and delete the originals (rather than renaming them), then some disk space may be freed on the source drive. The free space may be the result of moving the files to another drive, or of overwriting a larger destination file with a smaller source file. MOVE displays the amount of disk space recovered unless the /Q option is used (see below). It does so by comparing the amount of free disk space before and after the MOVE command is executed. However, this amount may be incorrect if you are using a deletion tracking system which retains deleted files for later recovery, or if another program performs a file operation while the MOVE command is executing.

 

Use caution with the /A: and /H switches (both of which can allow MOVE to process hidden files) when you are physically moving files, and both the source and destination directories contain file descriptions. If the source file specification matches the description file name (normally DESCRIPT.ION), and you tell MOVE to process hidden files, the DESCRIPT.ION file itself will be moved, overwriting any existing file descriptions in the destination directory. For example, if the C:\DATA directory contains file descriptions, this command would overwrite any existing descriptions in the D:\SAVE directory:

 

[c:\data] move /h d* d:\save\

 

(If you remove the hidden attribute from the DESCRIPT.ION file the same caution applies even if you do not use /A: or /H, as DESCRIPT.ION is then treated like any other file.)

 

Note: The wildcard expansion process will attempt to allow both CMD-style "extension" matching (only one extension, at the end of the word) and the advanced TCC string matching (allowing things like *.*.abc) when an asterisk is encountered in the destination of a MOVE command.

 

MOVE supports regular expression back references in the target name. If you are using back references, you must also use a regular expression in the source name. The syntax is:

 

move ::filename ::target

 

MOVE supports connected web folders. If an HTML file (i.e.,  with an .htm or .html extension) is copied, MOVE will look for a  folder in the same directory with the same name and an extension of ".files". If it is found, the .files directory will be moved to the target directory. You can disable connected web folders by setting the registry key:

 

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\NoFileFolderConnection=0

 

You can override the default HTTP proxy server, proxy user, and proxy password (set in TCMD.INI) with the /Proxy... options.

 

/Proxy=server

/ProxyUser=username

/ProxyPwd=password

 

Options:

 

/=Display the MOVE command dialog to help you set the filename and command line options. You cannot specify any other arguments on the command line.

 

/A:Select only those files that have the specified attribute(s) set. See Attribute Switches for information on the attributes which can follow /A:. See the cautionary note under Advanced Features and Options above before using /A: when both the source and destination directories contain file descriptions. Do not use /A: with @file lists. See @file lists for details.

 

You can specify /A:= to display a dialog to help you set individual attributes.

 

/BIf MOVE can't move the file (i.e., access denied), it will schedule it to be moved at the next reboot.

 

/CMove files only if the destination file exists and is older than the source (see also /U). This option is useful for updating the files in one directory from those in another without moving any newly-created files. Do not use /C with @file lists. See @file lists for details.

 

/CFMove files only if the destination file exists and is more than 2 seconds older than the source (see also /U and /UF). Do not use /CF with @file lists. See @file lists for details.

 

/DRequires that the destination be a directory. If the destination does not exist, MOVE will prompt to see if you want to create it. If the destination exists as a file, MOVE will fail with an "Access denied" error. Use this option to avoid having MOVE accidentally interpret your destination name as a file name when it's really a mistyped directory name.

 

/ESuppress all non-fatal error messages, such as "File Not Found."  Fatal error messages, such as "Drive not ready," will still be displayed. This option is most useful in batch files and aliases.

 

/GDisplays the percentage of the file moved, the transfer rate (in Kbytes/second), and the estimated time remaining. This is useful when copying large files across networks or via FTP to show whether the move is proceeding. /G will also display the % moved even if Windows is doing a rename (which may be a copy & delete internally).

 

/HMove all files, including hidden and system files. See the cautionary note under Advanced Features and Options above before using /H when both source and destination directories contain file descriptions.

 

/I"text"Select source files by matching text in their descriptions. The text can include wildcards. The search text must be enclosed in double quotes, and must follow the /I immediately, with no intervening spaces. You can select all filenames that have a description with /I"[?]*", or all filenames that do not have a description with /I"[]". Do not use /I with @file lists. See @file lists for details.

 

/JCopy the file in restartable mode. The copy progress is tracked in the destination file in case the move fails. The copy can be restarted by specifying the same source and destination file names.

 

/KIf the MOVE is to a different drive, move the source file to the recycle bin instead of deleting it. When deleting to the recycle bin, MOVE checks the RECYCLEEXCLUDE environment variable. If the file matches, MOVE deletes the file instead of sending it to the recycle bin.

 

/LPerform FTP transfers in ASCII mode, instead of the default binary mode.

 

/LDWhen used with /S, if the source is a symbolic or hard link to a directory, MOVE will create the link in the target directory instead of moving the subdirectory tree.

 

/MMove only files that have the archive bit set. The archive bit will remain set after the MOVE. Do not use /M with @file lists. See @file lists for details.

 

/MDCreate the target directory if it doesn't exist. (Note that you *must* either terminate the target directory name with a trailing \ or specify a filename component; otherwise MOVE cannot tell what you want for the directory and what you want for the filename!)

 

/NDo everything except actually move the file(s). This option is most useful for testing what a complex MOVE command will do. /N displays how many files would be moved. /N does not prevent creation of destination subdirectories when it is used with /S.

 

A /N with one or more of the following arguments has an alternate meaning:

 

dSkip hidden directories (when used with /S)
eDon't display errors.
jSkip junctions (when used with /S)
nDon't update the file descriptions
sDon't display the summary.
tDon't update the CD / CDD extended directory search database (JPSTREE.IDX).

 

/ODon't move the file(s) unless the target doesn't exist, i.e. do not overwrite an existing target..

 

/O:...Sort the files before processing.

 

You may use any combination of the sorting options below. If multiple options are used, the listing will be sorted with the first sort option as the primary key, the next as the secondary key, and so on:

 

nSort by filename and extension, unless e is explicitly included. This is the default.
-Reverse the sort order for the next sort key
aSort names and extensions in standard ASCII order, instead of numerically when numeric substrings are included in the name or extension.
dSort by date and time (oldest first); also see /T:acw
eSort by extension
gGroup subdirectories first, then files
rReverse the sort order for all options
sSort by size
tSame as d
uUnsorted

 

/PPrompt the user to confirm each move. Your options at the prompt are explained in detail under Prompts.

 

/Proxy=server

 

/ProxyUser=username

 

/ProxyPwd=password

 

/QDon't display filenames, the total number of files moved, the percentage moved, or the amount of disk space recovered, if any. When used in combination with the /P option above, it will prompt for filenames but will not display the totals. This option is most often used in batch files. See also /T.

 

/RPrompt for a Y or N response before overwriting an existing destination file.

 

/SMove an entire subdirectory tree to another location. MOVE will attempt to create the destination directories if they don't exist, and will remove empty subdirectories after the move. When /D is used with /S, you will be prompted if the first destination directory does not exist, but subdirectories below that will be created automatically by MOVE. If MOVE /S creates one or more destination directories, they will be added automatically to the JPSTREE.IDX database. If you attempt to use /S to move a subdirectory tree into part of itself, MOVE will detect the resulting infinite loop, display an error message, and exit. You cannot combine multiple /S options (including /S, /Sn, /S+1, or /SX) in a single command, or use any /S option with @file lists. See @file lists for details.

 

If you specify a number after the /S, MOVE will limit the subdirectory recursion to that number. For example, if you have a directory tree "\a\b\c\d\e", /S2 will only affect the "a", "b", and "c" directories.

 

If you specify a + followed by a number after the /S, MOVE will not move any files until it gets to that depth in the subdirectory tree. For example, if you have a directory tree \a\b\c\d\e, /S+2 will not move anything in \a or \a\b.

 

MOVE will display the empty source subdirectories it is removing (unless you use the /Q option).

 

/SXMove the subdirectory tree to a single target directory (implies /S). MOVE will remove empty subdirectories after the move. You cannot combine multiple /S options (including /S, /Sn, /S+1, or /SX) in a single command, or use any /S option with @file lists. For example, to move all of the .EXE files in c:\files and all of its subdirectories to the directory d:\exefiles:

 

copy /sx c:\files\*.exe d:\exefiles\

 

/TDon't display filenames as they are moved, but display the total number of files moved.

 

/UMove each source file only if it is newer than a matching destination file or if a matching destination file does not exist (also see /C). This option is useful for moving new or changed files from one directory to another. Do not use /U with @file lists. See @file lists for details. When used with file systems that have different time resolutions (such as FAT and NTFS), /U will attempt to use the "coarsest" resolution of the two.

 

/UFMove each source file only if it is more than 2 seconds newer than a matching destination file or if a matching destination file does not exist (also see /C and /CF). Do not use /UF with @file lists. See @file lists for details.

 

/VVerify each disk write by performing a true byte-by-byte comparison between the source and the newly-created target file. This option may significantly increase the time necessary to complete a MOVE command. /V will not work for FTP, TFTP, or HTTP moves.

 

/WIf the MOVE is to a different drive, after the move overwrite the source file contents using the DoD 5220.22-M (E) standard for secure deletion. (This overwrites every byte in the file three times with different values). Use this option to completely obliterate a file's contents from your disk. Once you have used this option it is impossible to recover the file even if you are using an undelete utility, because the contents of the file are destroyed before it is deleted.

 

/YForce copy of an encrypted file even when the target will be decrypted (for CMD compatibility).

 

/ZOverwrite read-only destination files. Without this option, MOVE will fail with an "Access denied" error if the destination file has its read-only attribute set. This option allows MOVE to overwrite read-only files without generating any errors.