0
votes

When tarring a directory with over 10K image files and a CSV file using --files-from, I end up with double of everything. I'm not real familiar with tar, and would like some help with this.

Currently, I'm running the exec command from a PHP script. The placement of the resulting files are working how I want. However, just can't get it to only include one copy of the files in the tar.gz file. The code below is what I'm running currently.

// the archiveExportPath includes a directory path to the location where the tar.gz file will be stored.
exec("cd {$this->tmpDirectory} && find -name '*.*' -print >../export.manifest");
exec("cd {$this->tmpDirectory} && sudo tar -czf {$this->archiveExportPath} --files-from ../export.manifest");

What I'd like to see is only including one copy of the .jpg files and .csv file inside the tar.gz

1

1 Answers

0
votes

I found a solution. Changing the command to search for specific files did the trick.

exec("cd $tmpDir && find . \( -name '*.jpg' -o -name '*.csv' \)  -print >../export.manifest");