banner



Useful Commands to Manage Files and Folders using Command Prompt

This article lists downward diverse commands that you can apply to manage files and folders through Command-Line in Windows 11/ten. Although a lot of users prefer using a graphical user interface to manage files for a hassle-free experience, some likewise use the command-line interface to perform file management tasks. In any case, it is ever meliorate to know alternative solutions to execute a task.

In this guide, I will be creating a list of useful commands that yous tin can utilize for file or folder management on your Windows 10 PC. To perform a specific chore on files or folders, there is a dedicated command that y'all demand to enter in CMD. Let's bank check out these commands!

Useful Commands to Manage Files and Folders through CMD in Windows 10

Commands to Manage Files and Folders through CMD

Here are the commands that y'all should know to manage files and folders using Command Prompt in Windows 11/10:

1] Create a File or Folder in CMD

To create a folder, type the folder name with the location where you lot want to create the binder. Here is the control:

mkdir <binder proper name with path>

For case;

mkdir C:\Users\KOMAL\Documents\TWC

To create a file of a specific size (in bytes), utilise the below command:

fsutil file createnew file.txt 4000

In identify of file.txt, enter the filename with its extension and full path. And, 4000 is the file size in bytes.

Related: How to Create Multiple Folders using Command Prompt and PowerShell.

2] Delete Files or Folder in CMD

You tin can remove a binder using the below command:

rmdir <folder proper name with path>

In society to delete a file, the command is:

del "<filename with path>"

If you want to delete all files from the electric current folder, enter the control:

del *

To delete files with a specific extension just, say png, use the control:

del *.png

If you lot desire to delete files with a particular string in their filename, e.thou., xyz, you tin utilise the below command:

del *xyz*

three] Notice Files in a Detail Folder

To find files within a folder based on different parameters, yous first need to navigate to the folder using the control:

cd "<folder name with location>"

Now, you can observe files older than north days in a specific folder using the below command:

forfiles /southward /m *.* /d -northward /c "cmd /c repeat @file

Replace -n with the number of days. Like if yous want to find files older than 2 days, blazon -ii.

To notice files larger than a specific size, utilise the command:

forfiles /Southward /Thousand * /C "cmd /c if @fsize GEQ 3741824 repeat @path"

In the above command, 3741824 is the file size to search files greater than this size.

iv] Rename all file extensions nowadays in a folder at in one case

Y'all can also batch rename file extensions in CMD. Suppose, you want to rename the file extension of all images to JPG, yous tin can use the beneath command:

ren *.* *.jpg

5] Get File Creation Time and Date

To check the creation time and date of a specific file, use the command:

dir /T:C filename

6] Check for a string inside a file

To find all lines containing a detail string in a file, you lot can use the control:

findstr string file-proper name

For example, to display all lines with "twc" in a text file, you lot demand to enter the command:

findstr twc twc.txt

Do remember that the to a higher place command is case-sensitive.

To notice sentences with whatsoever specified cord, use a command like:

findstr /C:"string1 string2 string3..." filename

7] Check for all Hidden Files in a Folder

Use the below command to get a list of hidden files in a directory:

dir /A:H /B

8] Compress a File in CMD

The control to shrink a file in a binder is:

compact /c filename

9] Hide/ Unhide a file through CMD

To hide a file, the command used is:

attrib + h filename

Y'all can unhide the file again using the command:

attrib -h filename

10] Ready/ Unset Read-Only attribute to a file

To make a file read-only, the command is:

attrib +R filename

If you want to remove the read-only attribute from a file, the command is:

attrib -R filename

11] Command to Rename a File/Folder

rename oldfilename.pdf newfilename.pdf

12] Read File Content in CMD

You tin read text file content in CMD using the beneath command:

more filename

13] Open a File in Default Application

You tin open a file in its default application by entering a simple control:

"filename-with-path"

14] Move File / Binder to unlike Location

Suppose you want to move TWC12.pdf file to TWC folder in G bulldoze, use below command:

movement TWC12.pdf Thou:\TWC\

Command to move all files with a specific extension:

movement *.png G:\TWC\

To move files starting with a item letter, say A, command is:

move A* K:\TWC\

Similarly, you can move a folder using a command like below:

move foldername <new location>

For example:

move TWC1 G:\TWC\

fifteen] Control to Copy Files

You can copy files from 1 location to another using command:

copy Sourcefolder DestinationFolder

Promise this article helps yous larn some useful commands to manage files and folders through the command line in Windows xi/10.

Useful Commands to Manage Files and Folders through CMD in Windows 10

Source: https://www.thewindowsclub.com/commands-to-manage-files-and-folders-through-cmd

Posted by: wagnerimme1941.blogspot.com

0 Response to "Useful Commands to Manage Files and Folders using Command Prompt"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel