Recursively remove desktop.ini files

I'm trying to delete all of the desktop.ini files in a given directory; namely Documents\Gio. I've tried del /S desktop.ini and del /S *.ini in cmd (admin mode) and get-childitem .\ -include desktop.ini -recurse | foreach ($_) {remove-item $_.fullname} and get-childitem .\ -include *.ini -recurse | foreach ($_) {remove-item $_.fullname} in PowerShell (also admin). Neither have worked. What should I do?

The desktop.ini files contain the following:

InfoTip=This folder is shared online.
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe

I move the directory from my Google Drive folder but all the folders still have the shared icons on them. I was trying to change the directory and all it subdirectories and files' ownership to a different account. I tried to do this with Google Drive but only the root directory changed ownership; I can't delete any of the files or directories therein.

del /s /a desktop.ini

See del /? for help.

Using Bash, how can I delete all the desktop.ini in my external drive , Remove desktop.ini files from User Shares (Powershell). This is a little script I wrote when I once had user Documents folders point to their user  To hide desktop.ini file, open File Explorer. Go to the View tab. At the far right end, click the dropdown button under the Options button. Select “Change folder and search options’. On the Folder options window, go to the View tab. Under the Advanced Settings section, look for an option called ‘Hide protected operating system files

This is what I used for Windows 2012 server

Create Desktop.ini files

My desktop.ini files were created from running this script which sets default folder options

$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
Set-ItemProperty $key Hidden 1
Set-ItemProperty $key HideFileExt 0
Set-ItemProperty $key ShowSuperHidden 1
Stop-Process -processname explorer

Remove Desktop.ini files

# Remove from your user desktop
gci "$env:USERPROFILE\Desktop" -filter desktop.ini -force | foreach ($_) {remove-item $_.fullname -force}

# Remove from default desktop
gci "C:\Users\Public\Desktop" -filter desktop.ini -force | foreach ($_) {remove-item $_.fullname -force}

Remove desktop.ini files from User Shares (Powershell), I'm trying to come up with a way to delete all the desktop.ini files from the user's home folders on a server. the path is basically d:\users\%username%. Get-ChildItem -Force -Recurse -File -Filter "desktop.ini" -Force -> force seeing all child items even hidden ones, most "desktop.ini" are hidden-Recurse -> to be recursive-File -> to get only files else it could find a folder named "desktop.ini"-Filter "desktop.ini" -> to only get items named "desktop.ini" The last part removes the item. Remove-Item

This will grab every folder in your home directory, and then search that folder for desktop.ini and delete it. It should be faster than using -recurse because it won't search subfolders. It should finish neatly with no errors

foreach ($file in Get-ChildItem -path \\server\homedrivedirectory) {
Get-ChildItem $file.FullName -Filter desktop.ini -force | remove-item -force -WhatIf

This will grab every folder in your home directory, and then create a path for every folder to \server\homedrivedirectory\user\desktop.ini and then delete that file. It should run a little faster as it doesn't have to search each user folder but it will turn up errors for every user folder that doesn't have a desktop.ini

foreach ($_ in Get-ChildItem -path \\server\homedrivedirectory) {
$path = $_.fullname
Remove-Item "$path\desktop.ini" -Force -WhatIf

I've left a -whatif so you can see what it would do in your environment without it doing it. If you want it to actually delete the files remove the -whatif

Delete desktop.ini from user folders on a server Solutions, Solution: How about NOT removing the "My Documents"-folder, but the name is Documents not My Documents (that name is handled by the desktop,ini file). How do I delete files or folders recursively on Windows from the command line? I have found this solution where path we drive on the command line and run this command. I have given an example with a .svn file extension folder: for /r %R in (.svn) do if exist %R (rd /s /q "%R")

With powershell, you use the Get-ChildItem (alias gci) cmdlet to retrieve all desktop.ini files and pipe it to Remove-Item (alias rm):

gci 'C:\YOURPATHTODOCUMENTS\GO' -Filter desktop.ini  -Recurse | rm

[SOLVED] Powershell script to recursive delete folders., The PowerShell command below can be used to remove thumbs.db files from the current folder, and all sub folders. Make sure you change  -r, -R, --recursive remove directories and their contents recursively rm has no file searching functionality, its -r switch does not make it descend into local directories and identify files matching the pattern you give it. Instead, the pattern (*.o) is expanded by the shell and rm will descend into and remove any directories whose name matches

PowerShell Command to Recursively Delete Thumbs.db , My OS is Windows 7 Professional 64 bit. I found that there is one file nameddesktop.ini (notice that it's not virus like_desktop.ini) in many of my  This line is going to remove all files with a dot in the begining of the name inside the current directory, and all files with same circumstances inside other folders inside this directory too. Be aware about it when using it.

HELP! Remove unwanted DESKTOP.INI file, Stupid Windows 2008R2 insists on creating a desktop.ini file in every user's home folder, You can just do a recursive delete of desktop.ini. ‘This script will delete, recursively: ‘ – All desktop.ini files ‘ – All Thumbs.db files ‘ – All files older than “olderThanDays” ‘ – All empty folders ‘Run it multiple times to delete multiple empty folders ‘Example: Script needs to be run 3 times to delete all empty folders for C:\empty1\empty2\empty3 Option Explicit

Set Deny permissions to desktop.ini in user folders by default?, I am trying to delete a directory recursively with rm -Force -Recurse somedirectory , I get several "The directory is not empty" errors. If I retry the same command, it  You need to use the rm command to remove files or directories (also known as folders) recursively. The rmdir command removes only empty directories. So you need to use rm command.

Force-remove files and directories in PowerShell fails sometimes , In most projects you will have files and folders that should not be subject to version control. *.user (Visual Studio), backup files *.bak, Backup*/ , Shell metadata files Thumbs.db, Desktop.ini, . Ignore item(s) recursively If you want to remove one or more items from the ignore list, in current version of TortoiseGit, you 

  • Do you get any errors?
  • No, it acts like it works but the files are still there.
  • It didn't work. It acted like it did but the files are still there.