Windows moving files and folders

How permissions are handled when you copy and move files and folders

This article describes how Windows Explorer handles file and folder permissions in different situations.

Original product version: В Windows 10 — all editions, Windows Server 2012 R2
Original KB number: В 310316

Summary

In Microsoft Windows 2000, in Windows Server 2003, and in Windows XP, you have the option of using either the FAT32 file system or the NTFS file system. When you use NTFS, you can grant permissions to your folders and files to control access to those objects. When you copy or move a file or folder on an NTFS volume, how Windows Explorer handles the permissions on the object varies, depending on whether the object is copied or moved within the same NTFS volume or to a different volume.

More information

By default, an object inherits permissions from its parent object, either at the time of creation or when it is copied or moved to its parent folder. The only exception to this rule occurs when you move an object to a different folder on the same volume. In this case, the original permissions are retained.

Additionally, note the following rules:

The Everyone group is granted Allow Full Control permissions to the root of each NTFS drive.

Deny permissions always take precedence over Allow permissions.

Explicit permissions take precedence over inherited permissions.

If NTFS permissions conflict, for example, if group and user permissions are contradictory, the most liberal permissions take precedence.

Permissions are cumulative.

To preserve permissions when files and folders are copied or moved, use the Xcopy.exe utility with the /O or the /X switch.

The object’s original permissions will be added to inheritable permissions in the new location.

To add an object’s original permissions to inheritable permissions when you copy or move an object, use the Xcopy.exe utility with the -O and -X switches.

To preserve existing permissions without adding inheritable permissions from the parent folder, use the Robocopy.exe utility, which is available in the Windows 2000 Resource Kit.

You can modify how Windows Explorer handles permissions when objects are copied or moved to another NTFS volume. When you copy or move an object to another volume, the object inherits the permissions of its new folder. However, if you want to modify this behavior to preserve the original permissions, modify the registry as follows.

This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, see How to back up and restore the registry in Windows.

Click Start, click Run, type regedit in the Open box, and then press ENTER.

Locate and then click the registry key: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer .

On the Edit menu, click Add Value, and then add the following registry value:

  • Value name: ForceCopyAclwithFile
  • Data type: DWORD
  • Value data: 1

Exit Registry Editor.

You can modify how Windows Explorer handles permissions when objects are moved in the same NTFS volume. As mentioned, when an object is moved within the same volume, the object preserves its permissions by default. However, if you want to modify this behavior so that the object inherits the permissions from the parent folder, modify the registry as follows:

Читайте также:  Winrar контекстное меню windows

Click Start, click Run, type regedit, and then press ENTER.

Locate and then click the registry subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer .

On the Edit menu, click Add Value, and then add the following registry value:

  • Value name: MoveSecurityAttributes
  • Data type: DWORD
  • Value data: 0

Exit Registry Editor.

Make sure that the user account that is used to move the object has the Change Permissions permission set. If the permission is not set, grant the Change Permissions permission to the user account.

The MoveSecurityAttributes registry value only applies to Windows XP and to Windows Server 2003. The value does not affect Windows 2000.

How to move files and folders on the computer

There are several methods available to move computer files and folders (directories) from one source or level to another. Click one of the links below to view steps relating to the operating system you need help with, or scroll down to review them all.

When moving files or folders, you’re going to have only one copy of the files moved. If you want more than one copy of the files, copy the files and not move them. See: How to copy files.

How to move files in Windows

In Windows, you can move files using several method. You can drag-and-drop, cut and paste, or use the «Move to Folder» command. Below are the steps on how you can move files in Windows. Choose the option that works best for you.

You can also select multiple files and move multiple files at once using any of the steps below. See: How to select or highlight multiple files and folders.

Cut and paste

To cut and paste a file, select the file you want to move, right-click the highlighted file, and then select Cut. Browse to the folder you want to move the file to, right-click in the folder, and select Paste.

Alternatively, you can click Edit from the file menu, select Cut to cut the files, browse to where you want to move the files, then select Edit and Paste in the file menu.

Finally, you can also use shortcut keys to cut and paste files. Select the files you want to cut, then press the shortcut key Ctrl + X to cut the files. «Cutting» the files is like cutting text in a document: it moves the files to a temporary «clipboard» until you «paste» them somewhere. Navigate to the destination folder and press the shortcut key Ctrl + V to paste the files. The files are now in your destination folder.

Drag-and-drop

Highlight the files you want to move, press and hold your right mouse button, and drag-and-drop the files to where you want to move them. When you release the mouse button, a menu appears, similar to the example shown in the picture. Select the Move here option to move the files.

For drag-and-drop to work, you’ll need to be able to see the window of where you are moving the files.

Use «Move to Folder»

To use the «Move to Folder» command, select the file by clicking the file name. Click the Edit menu near the top-left of the window and select the Move to Folder option. In the new window browse to the folder you would like to move the file, then click the Move button to move the file to that folder.

If you are using Windows 8, once the files are selected the Move to option is shown under the Home tab.

How to move files in the Windows command line (MS-DOS)

In the Windows command line and MS-DOS, you can move files using the move command. For example, if you want to move a file named «stats.doc» to the «c:\statistics» folder, you would type the following command, then press the Enter key.

Читайте также:  Python ������ linux �������

If you’d like to move multiple files, you can separate the file names with a comma, as in the following command.

In the next example, we are moving the file «example.doc» to the D:\ drive.

You can also move multiple files with wildcards. In the example below, the move command moves all files that have the «.doc» file extension to the «c:\statistics» directory.

Using the move command, you can also move a directory (folder). In the example below, the move command moves the «example» directory in the current directory to the «new» directory also in the current directory.

If you want to move a directory or file into a different directory, you need to specify the full path.

  • See our move command reference for full information, available options, and other examples on this command.

How to move files in macOS

There are several ways to move files in macOS.

Drag-and-drop

In the macOS Finder, you can drag-and-drop one or more file icons, moving them from one folder to another. To drag-and-drop a file, highlight the files you want to move. Click any of them, and before you release the mouse button, move the mouse cursor until it is over the destination folder. Release the mouse button to move the files to this location.

Keyboard shortcut

You can also move files using keyboard shortcuts by following the steps below.

  1. Highlight the files you want to move.
  2. Press the keyboard shortcut Command + C .
  3. Move to the location you want to move the files and press Option + Command + V to move the files.

Terminal

To move files in the Terminal command line, use the mv command.

Move files and directories to another location

This tutorial explains how to move files or directories to another location on a Windows system.

Move files to another directory

Example: to move file ‘data.docx’ to the folder ‘d:\backup\folder’

You can also rename the file while moving it to the new location

We can’t move multiple files with single command. i.e the below command would not work.

This would give the error The syntax of the command is incorrect .

However we can use wildcards to move files in bulk. For example, if you want to move all text files from current folder to a new location you can use the below command.

To move all files starting with letter ‘A’, you can use below command.

Move directories

Example: To move the directory ‘data’ to ‘D:\data\folder1\’

1. Can we move multiple directories using wild cards like the way we do it with files?
No, wild cards does not work for directories. You get the below error

2. How to specify the directories/files which have white spaces in the names?
You need to enclose the name of the file/directory in double quotes.

Errors

If you do not have write privileges on source file/directory or on the destination folder, you would get error as below.

Could some one point out why windows command line could not execute

move file1 file2 destinationDirectory ?

Because with the syntax the command is expecting, you told it to move file1 to file2 (which already isn’t going to work) and then gave it an argument of destination Directory, which it then has no idea what to do with, cause it isn’t a valid argument, in addition to the command you issues failing.

very helpful, I am missing one piece, I am trying to move all files from a “Camera Uploads” folder (dropbox) to another folder… not sure how to do a move involving all files inside a directory with a space… any ideas… “C:\Dropbox\Camera Uploads\*.*” doesn’t work… thanks!

Читайте также:  Ccleaner для windows 10 русском

i think this would do the trick
“C:\Dropbox\Camera Uploads\*”

hi,
can anyone suggest, how can I achieve below, via DOS command ?
I want to move all files and folders from source folder to destination folder.
e.g. C:\source\file1.txt
C:\source\file1.txt
C:\source\subsource\file1.txt

I want to move everything form C:\source form C:\destination ( like CUT from C:\source and PASTE into C:\Destination)

Thanks in advance.

If you want to copy all files from C :\ to destination you can use

move c:\> Source folder\*.* c:\destination folder

-move Just files not folders

if you to copy folder and files you can use XCOPY Command c:\xcopy *.* C:\ Destination folder

move -y “C:\source\file1.txt ” “C:\source\subsource\file1.txt”
pause

Can I use wildcard * to recognize the source and subsource directory in command line?

is there any window service which did the same work as you mentioned above. i.e transferring a file from one folder to another specified folder by a specific time interval in the background automatically. if you have some link regarding this please do share

There’s a pretty good wirte up on task scheduling on the windows club, check it out: http://www.thewindowsclub.com/how-to-schedule-batch-file-run-automatically-windows-7

Please suggest me how to move folders like 0123-03-000000001 to “Done” folder through batch file.

can I use batch file to execute command?
Thank you

wow! lots of examples for windows move command. Thanks for sharing.

Id like to create a script to move files of a size between let say 200 – 500MB from a specific location to another location.

Anyone know how to do this ? 🙂

Hey I would like to know how to move a folder or move files to a folder while naming the folder to Program Files and on the Desktop

I have a batch scrip that creates a sql dump then copies it to another server. I’m looking to move it so it is deleted from the directory originally created in. I tried the MOVE command but it doesn’t do anything. The script that works with just copying it is below anyone have any thoughts on how to modify this?

REM Export all databases into file C:\DB Backups\backup\docuware.[year][month][day].sql
“C:\Program Files (x86)\DocuWare\Internal Database V2\bin\mysqldump.exe” –all-databases –result-file=”C:\DB Backups\docuware.%TIMESTAMP%.sql” –user=admin –password=Toshiba1

REM Change working directory to the location of the DB dump file.
C:
CD \DB Backups

COPY “C:\DB Backups\” “E:\DW_PROD\Database Backups\Toshiba Tamarac Internal”

HI, Please provide how to move directory in to anoterh locatp

Hi, could you please help! I keep getting a The filename, directory name, or volume label syntax is incorrect error.
MOVE /-y “\\XYZ-nas\active matters\ABC\Morning\D1\processed\PDF\008\Morning_0086126__*.pdf” “\\XYZ-nas\active matters\ABC\Morning\D1\processed\Loose\07. Rathburnadette Email\top\Inbox\FW: BGD (unknown)\”

Hi,
Can anyone help me to move the files from multiple folders to multiple folders?
Example: I have folders like folder1 and in folder1 I have file1 and file and folder2 in folder2 I have file 3 and file and the destination folders are folder 3 and folder4.
we need to move the folder1 files to folder3 and folder2 files to folder4 at a time not one by one.

i have about 200,000 files that i want to write a program to move them (by key word in file name ) to different folders

move all files with any of these words in the file name (shtf,prepper,prepping,survival,bushcraft) to folder shtf

thats an example…. sas, small basic, dos prompt any hints? tks

Any way to perform a bulk move of files based on a string found inside the file? e.g. this does not work for me
move findstr “StringToFind” *.xml D:\PROD\ExceptionFolder

Hi
I want to move files from one directory to another only the latest file names are like this filename20190904.csv. I want to move these from one folder to other and replace the files with latest. And also want to exclude one file from source folder. any help would be appreciated

Including how to move across a network drive would be useful

Оцените статью
Adblock
detector