Do it "urself"!
Regards
Do it "urself"!
Regards
Thanx Marcel for the reply
Ok I 'll do it myself only.![]()
Always Believe in Urself![]()
Merry
Here it is. I just tested it:
This is where it starts( the wrapper):
Qt Code:
void qttest::clearAll() { clearAll(dirRoot); d.cdUp(); d.rmdir(dirRoot); }To copy to clipboard, switch view to plain text mode
This is the actual function:
Qt Code:
{ { if(finfo.isDir() ) { clearAll(finfo.absoluteFilePath()); dir.rmdir(finfo.absoluteFilePath()); } else { //file dir.remove(finfo.absoluteFilePath()); } } }To copy to clipboard, switch view to plain text mode
Regards.
Hi Marcel
Can u pls tell me in function
Qt Code:
void qttest::clearAll() { clearAll(dirRoot); d.cdUp(); d.rmdir(dirRoot); }To copy to clipboard, switch view to plain text mode
Why you used this(4th line of the above code) that is:
Thanx
Always Believe in Urself![]()
Merry
You should pass there the directory returned by the file dialog.
clearAll() without any parameters is just an overloaded variant of the second, provided for convenince.
It is really not that different than the first version.
I just passed a folder that I created on my hard disk.
And don't say it doesn't work because it does. If you don't mess up the code, then it will work for you too.
Regards
Hi Marcel
Thanx Marcel for helping me so much
Pls dont get angry on me....
I think I am not messing the code now , It is same as the code u sent to me , Is'nt it...
But it also deletes the files but not folders.....
Qt Code:
void Form1::ShowFileDialog() { "/home", filename->setText(m_file); } void Form1::DeleteData() { QString dirRoot = m_file; DeleteData(dirRoot); d.cdUp(); d.rmdir(dirRoot); } //////////////////////////////////////////////////////////////////////// /*Function for erasing*/ { if (dirPath.exists()) { QList<QFileInfo> infLst = dirPath.entryInfoList(); for(int i=0;i<infLst.size();i++) { if(!(strFileInfo.fileName() == "." || strFileInfo.fileName() == "..")) { if(strFileInfo.isDir()) { DeleteData(strFileInfo.absoluteFilePath()); dirPath.rmdir(strFileInfo.absoluteFilePath()); } else { dirPath.remove(strFileInfo.absoluteFilePath()); } } } } }To copy to clipboard, switch view to plain text mode
Thanx
Always Believe in Urself![]()
Merry
Are you sure you have permissions to delete the directories?
Are you running as root or as a normal user?
I m running as a normal user
Always Believe in Urself![]()
Merry
Well, could you try running it as root?
I tried it running as a root
It works , but for that directories only which contains files only.
not for that directories which contains both files and folders ..
Thanx
Always Believe in Urself![]()
Merry
Sorry, but can't help you. I really can't understand what's going on.
I tested it on the following structure. Every directory in there had 1,2 or three files in it.
So I can't say what is going on in your case.
Regards
merry (30th July 2007)
One more thing:
Make sure there isn't any browser opened on any of the directories you're trying to delete.
Actually, close all the browsers(file system browsers) and run the program.
Regards
Bookmarks