I need delete (automatically, recursively) lot of empty directories on server (there are non-empty dirs too). I have FTP access only (no SSH etc.).
Exist some client, which can do this? Preferably for Windows, but Linux may be too.
1 Answer
You could use FileZila (You can download it from )
Log in using your FTP credential and url . You should have the folder structure in the UI of FileZila.
Alternatively From Command Line :- Where yourdomain.com is your domain or the FTP Server IP Address found in the HELM Control Panel under the FTP Account Details.
c:\>ftp yourdomain.comOnce you hit Enter it will attempt to connect to the server. If it is successful, you will be prompted for a Username and Password. Enter the FTP username and password information to login.
mdelete folder_name/*
rmdir folder_nameThis Should do the job
If you can log on to the server try below
Try this for Windows :-You can use this utility: Remove Empty Directories
Alternatively you can use this one-liner batch file:
for /f "delims=" %%d in ('dir /s /b /ad ^| sort /r') do rd "%%d"One-liner taken from DownloadSquad, an excellent site to add to your RSS feeds. :)
Try this command for Linux:
find . -empty -type d -deleteThe find command is used to search for files/directories matching a particular search criteria from the specified path, in this case the current directory (hence the .).
The -empty option holds true for any file and directory that is empty.
The -type d option holds true for the file type specified; in this case d stands for the file type directory.
The -delete option is the action to perform, and holds true for all files found in the search.
I got it to work in two steps, on a server with restricted access, no SFTP, only FTP through commandline.
Like this :
mdelete folder_name/*
rmdir folder_name 3