473,382 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

delete directories

how do i delete the directories(having some files) only without delete the files,
rmdir wont remove the directory if it contains some files.
can any help me pls.?
Jul 20 '07 #1
3 2369
numberwhun
3,509 Expert Mod 2GB
how do i delete the directories(having some files) only without delete the files,
rmdir wont remove the directory if it contains some files.
can any help me pls.?
If you remove the directory, then whatever is in the directories goes bye bye as well. The only way to keep the files is to first move them to another directory, if you want to keep them. If you care not about the files, then you could issue something like 'rm -rf <directoryName' and that will force deletion of the directory and everything contained within.

Regards,

Jeff
Jul 20 '07 #2
If you remove the directory, then whatever is in the directories goes bye bye as well. The only way to keep the files is to first move them to another directory, if you want to keep them. If you care not about the files, then you could issue something like 'rm -rf <directoryName' and that will force deletion of the directory and everything contained within.

Regards,

Jeff
Sorry, i have written wrongly.
This is my task
my Top Directory contain some directories(x,y,z) and files(a,b,c)
each directory(x,y,z) contain some files say a1,b1,c1 etc.
i need to delete all the directories(x,y,z) without deleting the files(a,b,c)
any help?
Jul 20 '07 #3
skyy
109 100+
Sorry, i have written wrongly.
This is my task
my Top Directory contain some directories(x,y,z) and files(a,b,c)
each directory(x,y,z) contain some files say a1,b1,c1 etc.
i need to delete all the directories(x,y,z) without deleting the files(a,b,c)
any help?
use this command:

rm -R <directory name>
Jul 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jobs | last post by:
Hello All, I want to delete all files in a directory. I am making a backup copy of all files in the directories say c:\abc by reading and writing to a file. After making a backup copy I want to...
44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
1
by: James | last post by:
I am looking for a way to delete indirect children records when a root record is removed. The same action that occurs if you delete a directory that contains sub directories of sub directories. ...
4
by: David | last post by:
hello to everybody... in of directories on my pc i have a list of su-directories, and in each directory theres an image "picture.ico"... so then my program is starting to run, i add a new...
7
by: Charts | last post by:
I login as administrator of the machine. However running the following code get access denied exception for file inside the directory. The source code: DirectoryInfo target = new...
9
by: Paul | last post by:
I'm trying to make get my app to delete all the files in a specified folder and all the files within the folders of the specified folder. e.g. Folder 1 contains three files (File1, File2, File3)...
10
by: Dan | last post by:
Hi - I'm about a week into learning VB.NET, and I'm finding I can't delete any of the VB.NET directory structures that contain my test projects I've been trying to create. I've never seen this...
2
by: nospam | last post by:
I am writing this app in .net 2003 since all machines don't have 2.0 framework. I am trying to delete old profiles, but I am getting access denied or file in use errors. A lot of these files I am...
7
by: Anil Gupte | last post by:
Private Sub mnu2Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu2Exit.Click Dim fDir As String = Path.GetDirectoryName(L3Global.VideoFileName) ...
0
by: wolfsbane | last post by:
Alright, here it is I am trying to write a win32 app in VB 2005 to clean up user's profiles. everything works correctly except for the Delete("directory", True) statement. I get a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.