Comments on: LFCS #3: How to Archive Files, Set File Permissions and Finding Files in Linux https://www.tecmint.com/compress-files-and-finding-files-in-linux/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Mon, 11 Mar 2024 04:44:23 +0000 hourly 1 By: Ravi Saive https://www.tecmint.com/compress-files-and-finding-files-in-linux/comment-page-1/#comment-2146025 Mon, 11 Mar 2024 04:44:23 +0000 http://www.tecmint.com/?p=9226#comment-2146025 In reply to nthapa.

@Nthapa,

Thank you for your interest! You’re currently reading Part 3 of our series. If you’re looking for previous parts, you can find them in the table above.

]]>
By: nthapa https://www.tecmint.com/compress-files-and-finding-files-in-linux/comment-page-1/#comment-2144999 Fri, 08 Mar 2024 10:43:59 +0000 http://www.tecmint.com/?p=9226#comment-2144999 Where is the link of Part 3 above table?

]]>
By: Chiadi https://www.tecmint.com/compress-files-and-finding-files-in-linux/comment-page-1/#comment-1100620 Tue, 12 Feb 2019 13:30:31 +0000 http://www.tecmint.com/?p=9226#comment-1100620 In reply to Ravi Saive.

@Ravi,

Thanks a lot for your time and further explanation.

I understood him, the issue arise because I copied, pasted and ran the script but it gave me some errors.

On examination, I found out the file was not pasted in its original format. I formatted it and it was fine.

Thanks once more for your time; ravi means thrilled in French and I am thrilled.

]]>
By: Ravi Saive https://www.tecmint.com/compress-files-and-finding-files-in-linux/comment-page-1/#comment-1100580 Tue, 12 Feb 2019 06:25:38 +0000 http://www.tecmint.com/?p=9226#comment-1100580 In reply to CHIADI.

@Chiadi,

Gabriel already provided explanation of that command, see:

"#!/bin/bash
# Pass the directory to backup as first argument.
DIR=$1
# Create the tarball and compress it. Exclude files with the MPEG string in its file type.
# -If the file type contains the string mpeg, $? (the exit status of the most recently executed command) expands to 0, 
and the filename is redirected to the exclude option. Otherwise, it expands to 1.
# -If $? equals 0, add the file to the list of files to be backed up.
tar X <(for i in $DIR/*; do file $i | grep -i mpeg; if [ $? -eq 0 ]; then echo $i; fi;done) -cjf backupfile.tar.bz2 $DIR/*
]]>
By: CHIADI https://www.tecmint.com/compress-files-and-finding-files-in-linux/comment-page-1/#comment-1100515 Mon, 11 Feb 2019 19:09:01 +0000 http://www.tecmint.com/?p=9226#comment-1100515 Hi Gabriel,

Thanks for the nice write-ups. I am new to Linux and scripting, could you help explain this your line of code for a newbie:

tar X <(for i in $DIR/*; do file $i | grep -i mpeg; if [ $? -eq 0 ]; then echo $i; fi;done) -cjf backupfile.tar.bz2 $DIR/*
Or could you re-write it in an expanded form?

Thanks in anticipation.
Chiadi

]]>