Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Suppose we have a folder named dir/ in a folder named parent/
After deletion of the dir/ folder in a terminal command line. Analysis of the timestamps of the parent/ folder reveals that the M and C timestamps have been updated.
When deleting the same folder dir/ with Qt's removeRecursively function for deleting a folder. Analysis of the timestamps of the parent/ folder shows that the MACB timestamps have all been updated.
Is there a reason for this behaviour?
Especially when we know that for most other Qt functions operating on files, the modification of timestamps is similar to that of the terminal utilities.
Thanks for help
Hi and welcome to devnet,
Which version of Qt ?
On which OS ?
Can you show the code you are using as well as the command ?
There might be some subtle difference.
thank you for the reply
I use version 5.15.0 of Qt on Ubuntu 18.04.5 LTS
for deleting the folder on the command line:
rm -r dir/
For deleting the folder with Qt:
bool isDelete = dir.removeRecursively();
Well you can see the implementation at https://code.woboq.org/qt5/qtbase/src/corelib/io/qdir.cpp.html#_ZN4QDir17removeRecursivelyEv
What is a B timestamp?
ted19b last edited by ted19b
@JonB Though not specified by POSIX, Linux on EXT4 and FreeBSD on UFS2 store the date of creation (B).
JonB last edited by JonB
In that case, could you explain what the C timestamp is, and how that differs from the B one? M is Modification, A is Access, C is creation and B seems to be Creation too? I am interested :)
@JonB POSIX specifies MAC timestamps:
Each file has three distinct associated timestamps: the time of last data access, the time of last data modification, and the time the file status last changed. These values are returned in the file characteristics structure struct stat, as described in <sys/stat.h>.
Data access (A) is when the file data is read, data modification (M) when the file data is modified, and file status changed (C) when the file metadata is changed (chown, chmod, new hardlink updating the link count…).
Sorry I do get MAC, as per stat. What I am not understanding is what your B is and how it differs from C? Is it that the extra B remains fixed as date of creation, while C varies a bit more? TBH I didn't know C changed from e.g. chown, I thought C was your B....
sorry for the late reply. Indeed that's the idea. The B records the date of creation of the file and it doesn't change anymore.
While the C is updated according to the operations we can perform on the file.
for example: we have a tmp.txt file in a src/ folder.
copy this file to a dst/ folder will update the C timestamps of the src/ folder
JonB last edited by JonB
Thanks for all this information. I am old-time Unix user(!), very familiar with the MAC timestamps, never heard of your B one.
So, please help: I am Ubuntu.
lsblk -fsays my disk is
ext4. I don't see an option to
lsto display this B stamp, and what system call (like
stat) accesses it, please?
I think this article contains the answers to all your questions.
Thanks for this. My Ubuntu 20.04's
statis still one version too old to report this B. I didn't want to download anything, I used
debugfs -R 'stat <'`stat -c %i /etc/profile`'>' /dev/sda5
to see the Birth/crtime. Don't know what you use. Very interesting.
Anyway, I imagine like I said you'll want to look at the source code I referenced to follow its behaviour. I admit that glancing I can't see why parent would have its B/crtime changed, presumably that should only happen when something is created and I can't see that. I'd be interested to hear if you analyze/debug the code why that is occurring!