Questions tagged [rmdir]

The `rmdir` command is a Linux, DOS and Windows command used to remove a directory or folder.

The rmdir command is a Linux and Windows command used to remove a directory or folder.

Manpage for rmdir.

152 questions
2
votes
0 answers

Error: ENOTEMPTY: directory not empty, rmdir when I use fs.rmSync on a folder with nested folders

I have a react + node website in which I have the following route to delete a folder called cache and remake it. Basically it should "clear cache". const deleteCache = async (req, res) => { fs.rmSync('./cache', {recursive: true, force : true},…
Ruo
  • 77
  • 7
2
votes
3 answers

Delete a specific folder with a path as a parameter in python

I want to delete a Folder named "testfolder" and all the subfolders and files in it. I want to give the "testfolder" path as a parameter when calling the python file. For example ...... (testfolder location) and there it should delete the…
noggy
  • 85
  • 2
  • 9
2
votes
2 answers

How to remove a project directory that "cargo new" created

I, by mistake, have created a new project directory with cargo new communicator --bin, instead of cargo new communicator --lib. Then, I tried to remove the entire directory with rmdir --ignore-fail-on-non-empty communicator. This command doesn't…
Julia O
  • 221
  • 2
  • 13
2
votes
2 answers

Batch script to delete all folders except of "Starts with"

I have a folder with several subfolders. Structure is like: C:\foo C:\foo\web.foo C:\foo\web.bar C:\foo\win.foo C:\foo\win.bar C:\foo\mobile.foo C:\foo\mobile.bar I sometimes wish to delete the folders with its containing files with following…
swimagers
  • 33
  • 1
  • 4
2
votes
3 answers

How to remove a directory and its empty ancestors with Perl?

What is the Perl way of removing a directory and then all empty parent directories up to the first non-empty one? In other words, what could one use instead of: system 'rmdir', '-p', $directory; which, in starting with d, would first remove d and…
n.r.
  • 1,900
  • 15
  • 20
2
votes
1 answer

Using 'move' command instead of 'xcopy' in a loop

This line of code fines all folders in a directory that have a certain bit of text in common and copies all the contents of those folders to a new destination. dir /b /s /a:d "\\SERVER\Path\Directory\*FolderTag" | for /f "delims=\; tokens=3,4,5*"…
Neal
  • 199
  • 3
  • 16
2
votes
3 answers

Deleting Windows Temp Files using python script

Can you help me how can i delete all the files under the Windows/Temp files?? Below are my scripts but it doesn't work at all. import os import subprocess recPath = 'C:\\Windows\\Temp' ls = [] if os.path.exists(recPath): for i in…
Aouie
  • 119
  • 2
  • 8
  • 17
2
votes
4 answers

Delete files then directory

I have this so far: "; …
MacMac
  • 34,294
  • 55
  • 151
  • 222
2
votes
2 answers

PHP Multi Directory delete

So I'm creating an image upload site and I need to delete multiple directories and files simultaneously. I have managed to create code that does the job however I'm unsure whether this is 'good code' as I'm repeating myself. Is there a better way to…
2
votes
2 answers

Windows: Deleting folder common in multiple sub-folders

Is there a way to do this? I have a folder structure as such: A/ Folder/ B/ Folder/ C/ Folder/ D/ Folder/ And I want to delete all of the "Folder/"s, along with all of their contents. My first guess was rmdir /S /Q *\Folder but…
Ledivin
  • 637
  • 5
  • 18
2
votes
1 answer

PHP recursively delete empty parent directories

Problem Background I have a multimedia web applications where users can save and delete files. The saved files are used for various application wide functionalities. When files are saved, they are put deep inside directory tree (usually 6 to 9…
Nis
  • 1,469
  • 15
  • 24
2
votes
2 answers

Remove directory from server that contains backslashes (PHP)

On my way to learning the mkdir(); function in PHP, I have created a folder on my server with a path like so files/New\\\\ Now, I can not delete this for the life of me... I found one other post that said I would need to use rmdir(); and escape…
VIDesignz
  • 4,703
  • 3
  • 25
  • 37
2
votes
1 answer

delete all the folders inside a parent folder

How to delete all the folders inside a parent folder with PHP? I have tried this, but it isn't working: function rrmdir($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." &&…
PHP kid
  • 55
  • 9
2
votes
1 answer

bat file to delete containing folder when double clicked?

What I would like to do in my batch file is delete ALL the contents of the containing directory AND the directory itself. Currently I am using the following command: rmdir ..\dir /S /Q & exit This works in that it deletes ALL of the contents in…
user972276
  • 2,973
  • 9
  • 33
  • 46
2
votes
1 answer

Mocha doesn't call rmdir in after() function

I try to create some tree of directories before tests and remove it after all: require('should'); var fs = require('fs'); var rmdir = require('rmdir'); describe('FsWatcher', function() { before(function(done) { console.log("before"); …
ciembor
  • 7,189
  • 13
  • 59
  • 100
1 2
3
10 11