
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Manage Files Archives - TECHNIG</title>
	<atom:link href="https://www.technig.com/tag/manage-files/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.technig.com/tag/manage-files/</link>
	<description>Gateway for IT Experts and Tech Geeks</description>
	<lastBuildDate>Wed, 29 Jul 2020 03:01:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>

<image>
	<url>https://www.technig.com/wp-content/uploads/2020/04/32x32.png</url>
	<title>Manage Files Archives - TECHNIG</title>
	<link>https://www.technig.com/tag/manage-files/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">162720667</site>	<item>
		<title>How to Manage Files and Folders with PowerShell?</title>
		<link>https://www.technig.com/manage-files-with-powershell/</link>
					<comments>https://www.technig.com/manage-files-with-powershell/#respond</comments>
		
		<dc:creator><![CDATA[Shais]]></dc:creator>
		<pubDate>Thu, 25 Feb 2016 04:00:11 +0000</pubDate>
				<category><![CDATA[MCSE]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Manage Files]]></category>
		<category><![CDATA[PowerShell Articles]]></category>
		<category><![CDATA[Windows 10]]></category>
		<category><![CDATA[Windows Server 2016]]></category>
		<guid isPermaLink="false">https://www.technig.com/?p=5958</guid>

					<description><![CDATA[<div style="margin-bottom:20px;"><img width="1090" height="617" src="https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Manage Files and Folders with PowerShell - Technig" decoding="async" fetchpriority="high" srcset="https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig.png 1090w, https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig-300x170.png 300w, https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig-1024x580.png 1024w, https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig-768x435.png 768w" sizes="(max-width: 1090px) 100vw, 1090px" /></div>
<p>Windows PowerShell has cmdlets that help you manage files with PowerShell easily within Servers and client machines. The following PowerShell articles provide a brief introduction to carrying out file system management tasks by using Windows PowerShell. These tasks include such things as creating, renaming, copying, verifying, and deleting files and folders with PowerShell. Manage Files [&#8230;]</p>
<p>The post <a href="https://www.technig.com/manage-files-with-powershell/">How to Manage Files and Folders with PowerShell?</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div style="margin-bottom:20px;"><img width="1090" height="617" src="https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Manage Files and Folders with PowerShell - Technig" decoding="async" loading="lazy" srcset="https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig.png 1090w, https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig-300x170.png 300w, https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig-1024x580.png 1024w, https://www.technig.com/wp-content/uploads/2016/02/Manage-FIles-and-Folders-with-PowerShell-Technig-768x435.png 768w" sizes="(max-width: 1090px) 100vw, 1090px" /></div><p>Windows PowerShell has cmdlets that help you manage files with PowerShell easily within Servers and client machines. The following <a href="https://www.technig.com/tag/PowerShell-Tutorials/" target="_blank" rel="noopener noreferrer">PowerShell articles</a> provide a brief introduction to carrying out file system management tasks by using Windows PowerShell. These tasks include such things as creating, renaming, copying, verifying, and deleting files and folders with PowerShell.</p>
<h1>Manage Files with PowerShell</h1>
<p>As Sysadmin you already should know the basics of PowerShell command-line structure. Here I&#8217;m trying to manage files using PowerShell with some File management cmdlets. So follow the PowerShell articles to learn more.</p>
<h2>#1. Listing Files and Folders with PowerShell</h2>
<p>The old dir command would list the files and folders contained within the specified directory within command prompt (cmd.exe). PowerShell has &#8220;<strong>Get-ChildItem</strong>&#8220;<strong> </strong>cmdlet.</p>
<p><strong>1.</strong> Open PowerShell on your Windows system. It&#8217;s better to run it as an administrator when you manage files and folders with PowerShell. Type &#8220;<strong>Get-ChildItem</strong>&#8221; to display the current directory files and folders.</p>
<figure id="attachment_5967" aria-describedby="caption-attachment-5967" style="width: 750px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Manage-Files-Using-PowerShell.jpg" rel="attachment wp-att-5967"><img decoding="async" class="wp-image-5967 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Manage-Files-Using-PowerShell.jpg" alt="Manage Files with PowerShell" width="750" height="342" /></a><figcaption id="caption-attachment-5967" class="wp-caption-text">Manage Files with PowerShell &#8211; Get-ChildItem Cmdlet</figcaption></figure>
<p>The &#8220;<strong>ls</strong>&#8221; command will list your files also, so the topic focuses on PowerShell File management cmdlets. Basically the Get-ChildItem works like <strong>dir</strong> command.</p>
<p>That&#8217;s not all, you can do more with Get-ChildItem such as &#8220;<strong>Get-ChildItem -Recurse</strong>&#8221; command. It will show all folders, sub-folders and files inside the folders.</p>
<figure id="attachment_5983" aria-describedby="caption-attachment-5983" style="width: 806px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Get-more-with-Get-ChildItem-command.jpg" rel="attachment wp-att-5983"><img decoding="async" class="wp-image-5983 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Get-more-with-Get-ChildItem-command.jpg" alt="Get more with Get-ChildItem command" width="806" height="630" /></a><figcaption id="caption-attachment-5983" class="wp-caption-text">Get more with Get-ChildItem command</figcaption></figure>
<p>You might want a list of all the files and folders in the sub-folders. Just simply add the <strong>-recurse</strong> parameter at the end like an above command. Read more about <a href="https://technet.microsoft.com/en-us/library/0f0a016b-a683-45f0-b362-13f453c0725e" target="_blank" rel="noopener noreferrer">Get-ChildItem</a>. It&#8217;s pretty good for sysadmins to do manage files with PowerShell.</p>
<h2>#2. Creating Folders with PowerShell</h2>
<p>The New-Item cmdlet will create a file or folder in a directory. You can specify the directory rather than the current directory you are located.</p>
<p><strong>1.</strong> To create a folder, simply type &#8220;<strong>New-Item</strong>&#8221; folder name. For instance, I have created a folder named helpline.  The full command &#8220;<strong>New-Item helpline -ItemType directory</strong>&#8220;.</p>
<figure id="attachment_5971" aria-describedby="caption-attachment-5971" style="width: 671px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Create-Folder-with-PowerShell.jpg" rel="attachment wp-att-5971"><img loading="lazy" decoding="async" class="wp-image-5971 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Create-Folder-with-PowerShell.jpg" alt="Create Folder with PowerShell" width="671" height="719" /></a><figcaption id="caption-attachment-5971" class="wp-caption-text">Create Folder with PowerShell</figcaption></figure>
<p>You must assign the item type in order to create a folder or and exact file type. The &#8220;<strong>-ItemType directory</strong>&#8221; is used for creating a folder with PowerShell.</p>
<h2>#3. Create Files with PowerShell</h2>
<p>Just like creating a folder, you can simply use -Type file&#8221; option to create a file. Do not forget to mention the file type or extension as well. Let&#8217;s create a text file on the helpline folder using PowerShell.</p>
<p><strong>1.</strong> Type <strong>New-Item filename.extension</strong>. For example, to create a text file withing helpline folder. Type &#8220;<strong>NewItem c:\NetworkFiles\helpline\Helpme.txt -ItemType file</strong>&#8220;.</p>
<figure id="attachment_5974" aria-describedby="caption-attachment-5974" style="width: 902px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Create-Files-with-PowerShell.jpg" rel="attachment wp-att-5974"><img loading="lazy" decoding="async" class="wp-image-5974 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Create-Files-with-PowerShell.jpg" alt="Create Files with PowerShell" width="902" height="261" /></a><figcaption id="caption-attachment-5974" class="wp-caption-text">Create Files with PowerShell</figcaption></figure>
<p>Yes, the file has been created successfully and you can check it with get-child item command. So good, let add some data or text to new file. The value parameter will help you add data to your files.</p>
<p>To add data to a text file, type &#8220;<strong>NewItem c:\NetworkFiles\helpline\Helpme.txt -ItemType file -Force -Value &#8220;Hello Jungle!&#8221;.</strong></p>
<figure id="attachment_5975" aria-describedby="caption-attachment-5975" style="width: 1220px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Add-data-to-a-text-file-with-PowerShell.jpg" rel="attachment wp-att-5975"><img loading="lazy" decoding="async" class="wp-image-5975 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Add-data-to-a-text-file-with-PowerShell.jpg" alt="Add data to a text file with PowerShell" width="1220" height="245" /></a><figcaption id="caption-attachment-5975" class="wp-caption-text">Add data to a text file with PowerShell</figcaption></figure>
<p>It will add the Hello Jungle word inside the helpme.txt file. The &#8211;<strong>Force</strong> parameter will replace the current file if it already exists.</p>
<h2>#4. Rename Files with PowerShell</h2>
<p>If type the files or folders wrong, the Rename-Item can be used to rename the files. Try to use and rename some files and folders.</p>
<p><strong>1.</strong> Let&#8217;s rename a file, the Helpme.txt to Readme.txt. Type &#8220;<strong>Rename-Item c:\NetworkFiles\helpline\Helpme.txt Readme.txt</strong>&#8221; then press enter.</p>
<figure id="attachment_5977" aria-describedby="caption-attachment-5977" style="width: 768px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Rename-Files-with-PowerShell.jpg" rel="attachment wp-att-5977"><img loading="lazy" decoding="async" class="wp-image-5977 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Rename-Files-with-PowerShell.jpg" alt="Rename Files with PowerShell" width="768" height="88" /></a><figcaption id="caption-attachment-5977" class="wp-caption-text">Rename Files with PowerShell</figcaption></figure>
<p>It will change the file without any prompt. So try to run the <strong>ls</strong> command to list the files inside the directory to see the changes.</p>
<h2>#5. Move File and Folders with PowerShell</h2>
<p>Related to manage files with PowerShell, like another command, moving files with PowerShell is also easy. The task will be accomplished with the Move-Item command.</p>
<p><strong>1.</strong> Let&#8217;s move the Readme.txt folder from <strong>helpline</strong> folder to the <strong>Sales</strong> folder. Type &#8220;<strong>Move-Item c:\NetworkFiles\helpline\Readme.txt c:\NetworkFiles\Sales\</strong>&#8221; then press enter.</p>
<figure id="attachment_5979" aria-describedby="caption-attachment-5979" style="width: 879px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Move-Files-and-Folders-with-PowerShell.jpg" rel="attachment wp-att-5979"><img loading="lazy" decoding="async" class="wp-image-5979 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Move-Files-and-Folders-with-PowerShell.jpg" alt="Move Files and Folders with PowerShell" width="879" height="89" /></a><figcaption id="caption-attachment-5979" class="wp-caption-text">Move Files and Folders with PowerShell</figcaption></figure>
<p>It will move the file without any prompt. So try to run the <strong>ls</strong> command again to see the files inside the Sales folder. The <strong>-Force</strong> parameter will overwrite the existing files.</p>
<h2>#6. Delete Files and Folders with PowerShell</h2>
<p>Deleting files and folder will be done with <strong>Remove-Item</strong>. It&#8217;s the main command to delete files or folder with PowerShell. Let&#8217;s delete the Readme.txt file and Helpline folder.</p>
<p><strong>1.</strong> To delete the Readme.txt file, type &#8220;<strong>Remove-Item Readme.txt</strong>&#8221; and press enter. It will delete the file.</p>
<figure id="attachment_5985" aria-describedby="caption-attachment-5985" style="width: 565px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Delete-Files-with-PowerShell.jpg" rel="attachment wp-att-5985"><img loading="lazy" decoding="async" class="wp-image-5985 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Delete-Files-with-PowerShell.jpg" alt="Delete Files with PowerShell" width="565" height="76" /></a><figcaption id="caption-attachment-5985" class="wp-caption-text">Delete Files with PowerShell</figcaption></figure>
<p>To delete a folder type &#8220;<strong>Remove-Item FolderName</strong>&#8221; and press enter. It will delete only the folder that doesn&#8217;t have any sub-folders. If you want to delete a folder with sub-folder or everything inside a folder, type &#8220;<strong>Remove-Item FolderName -Recurse</strong>&#8221; then press enter.</p>
<figure id="attachment_5987" aria-describedby="caption-attachment-5987" style="width: 648px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Delete-Mass-Filse-and-Folders-with-PowerShell.jpg" rel="attachment wp-att-5987"><img loading="lazy" decoding="async" class="wp-image-5987 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Delete-Mass-Filse-and-Folders-with-PowerShell.jpg" alt="Delete Mass Filse and Folders with PowerShell" width="648" height="115" /></a><figcaption id="caption-attachment-5987" class="wp-caption-text">Delete Mass Files and Folders with PowerShell</figcaption></figure>
<p>Yes, everything deleted successfully. The Remove-Item cmdlet also has many useful parameters that help you manage files with PowerShell better. Read more on <a href="https://technet.microsoft.com/en-us/library/4fe9e7bd-7776-440c-9216-bafd706309b3" target="_blank" rel="noopener noreferrer">Remove-Item</a>.</p>
<h2>#7. Verify the Existence of a File or Folder with PowerShell</h2>
<p>Is my files or folder exist on the shared folder? Yep, this command will help you to verify the existence of files and folders with PowerShell.</p>
<p><strong>1.</strong> To verify the existence of a folder, type &#8220;<strong>Test-Path c:\NetworkFiles\Sales</strong>&#8221; and press enter. Previously we have deleted the Sales folder and the result must be <strong>False</strong>.</p>
<figure id="attachment_5990" aria-describedby="caption-attachment-5990" style="width: 554px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Verify-FIles-and-Folder-Existence-with-PowerShell.jpg" rel="attachment wp-att-5990"><img loading="lazy" decoding="async" class="wp-image-5990 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Verify-FIles-and-Folder-Existence-with-PowerShell.jpg" alt="Verify FIles and Folder Existence with PowerShell" width="554" height="135" /></a><figcaption id="caption-attachment-5990" class="wp-caption-text">Verify FIles and Folder Existence with PowerShell</figcaption></figure>
<p>Yes, the <strong>Sales</strong> folder does not exist on NetworkFiles but the Products folder already exist. Let&#8217;s verify whether do we have any text files on the products folder. Type &#8220;<strong>Test-Path c:\NetworkFiles\Products\*.txt</strong>&#8221; and press enter.</p>
<figure id="attachment_5991" aria-describedby="caption-attachment-5991" style="width: 583px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/02/Verifying-Existing-Files-with-PowerShell.jpg" rel="attachment wp-att-5991"><img loading="lazy" decoding="async" class="wp-image-5991 size-full" src="https://www.technig.com/wp-content/uploads/2016/02/Verifying-Existing-Files-with-PowerShell.jpg" alt="Verifying Existing Files with PowerShell" width="583" height="95" /></a><figcaption id="caption-attachment-5991" class="wp-caption-text">Verifying Existing Files with PowerShell</figcaption></figure>
<p>Yes, the result is <strong>True</strong>, it means we have text files on Products folder. It will verify the Windows Registry keys as well. For instance &#8220;<strong>Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion</strong>&#8221; and press enter.</p>
<p>That&#8217;s are not all but enough for managing files and folders with PowerShell on Windows servers and Clients operating system.</p>
<p>Hope you have got something new about managing files and folders with PowerShell. If you have any questions, feel free to ask and comment us your helpful suggestions and feedback.</p>
<p>The post <a href="https://www.technig.com/manage-files-with-powershell/">How to Manage Files and Folders with PowerShell?</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.technig.com/manage-files-with-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5958</post-id>	</item>
	</channel>
</rss>
