FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Fri May 14, 2021 07:05



Post new topic Reply to topic  [ 5 posts ] 
How to compress individual files? 
Author Message

Joined: Wed Jun 16, 2010 20:21
Posts: 3
Post How to compress individual files?
I have read this: http://pagesperso-orange.fr/b.andre/compression.html and tried the command on a directory (correcting for x86 little-endianness) and it worked well. Now i wonder, how can i compress individual files as well as contents of previously uncompressed directory? I tried using this command on the file, but when i check this file in windows, it isn't showed as compressed nor has smaller size.


Wed Jun 16, 2010 20:27
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: How to compress individual files?
Hi,

Quote:
tried the command on a directory (correcting for x86 little-endianness) and it worked well

I assume you mean the setfattr command applied to the extended attribute system.ntfs_attrib. Well this command just sets a flag, it does not compress anything. On Windows Explorer you see the directory name in blue, just to show the flag is set. This flag is meaningful only when creating a new file into the directory.

Quote:
Now i wonder, how can i compress individual files as well as contents of previously uncompressed directory?

You have to copy (not rename !) the files into a directory having the compression flag set as mentioned above. After that you may move (rename, not copy !) the compressed files elsewhere in the same partition and delete the uncompressed file.

A common practice is to have specific directories to hold compressed files, all files in those directories being compressed when they are created.

Note : system.ntfs_attrib_be and full compression support are only available in ntfs-3g-2010.5.16AC.1 which is still a release candidate version. Plain copy (by cp) with compression is possible since ntfs-2009.11.14)

Regards

Jean-Pierre


Wed Jun 16, 2010 23:04
Profile

Joined: Wed Jun 16, 2010 20:21
Posts: 3
Post Re: How to compress individual files?
Quote:
I assume you mean the setfattr command applied to the extended attribute system.ntfs_attrib

Well... actually i tried system.ntfs_attrib_be as given in the article. What's the difference between these attributes?
Quote:
You have to copy (not rename !) the files into a directory having the compression flag set as mentioned above. After that you may move (rename, not copy !) the compressed files elsewhere in the same partition and delete the uncompressed file.

Is it a temporary workaround or will there exist an easier way as in windows for this? The way you suggested will have problems when there's no place on the disk for a copy of the file.


Thu Jun 17, 2010 14:41
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: How to compress individual files?
Hi,

Quote:
Well... actually i tried system.ntfs_attrib_be as given in the article. What's the difference between these attributes?

The difference is only about byte ordering. When using system.ntfs_attrib in getfattr/setfattr you have to adapt to the endianness of the CPU (which I thought you had to do as you mentioned "correcting for x86 little-endianness"), whereas with system.ntfs_attrib_be you use big-endian values whatever the CPU (when the documentation says readonly is flag 1, for most users it is easier to type 0x00000001 rather than find the endianness of the CPU and possibly have to type 0x01000000).
Alas for the system calls setxattr()/getxattr() it is the opposite, hence the need for two variants.
Note system.ntfs_attrib_be is a recent addition, you possibly do not have it available.

Quote:
Is it a temporary workaround or will there exist an easier way as in windows for this?

It will remain so until some gnome or KDE developer implements the necessary GUI triggering cp + mv (or someone tells me how to add to a file icon a method starting a user-defined shell script, grayed if the file is not on ntfs).
Quote:
The way you suggested will have problems when there's no place on the disk for a copy of the file.

Maybe some time I will implement an extended attribute to request compression on the spot... but this is far on my todo list.

Regards

Jean-Pierre


Thu Jun 17, 2010 18:53
Profile

Joined: Mon Jun 21, 2010 07:28
Posts: 1
Post Re: How to compress individual files?
Well the information which you have given here its really very useful. Before I have never think so. I always doing the compress the whole folder but never think to compress the particular file. And after reading this post I really came to know it. Now I am planning to apply the same trick.

_________________
4gb usb drive


Fri Jun 25, 2010 13:35
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.