Remove .svn files from zip file - linux

I would like to remove all svn directories from a zip file. Can not find correct pattern. This is the pattern I tried ".svn/*"
Was able to remove all .class files.

Found pattern. Should work for any directory.
"/.svn/"

Avoid the problem in the first place. Don't create your zip file directly from your working copy. Just use svn export to create a new directory without the .svn directories, and without any unversioned files, and zip that instead.

Related

Backup folder with a specific file inside with rsync

I'm using backupPC for backing up some .xml files in a Linux machine.
Specifically, we just need files called "config.xml"
For achieving it, I'm using backupPC with rsync, with these include/exclude parameters
--include="*/ --include="config.xml" --exclude="*"
in this way, i'm having lots of empty folders, and some with config.xml inside.
Is there a way to exclude all the folders which don't have config.xml inside?
The option you are looking for is --prune-empty-dirs.

Linux - how to rename files within a .tgz file without extracting contents and applying tar again?

I have a tar file called test.tgz , inside it are the following files:
tool.foo
atest.you
btest.you
ctest.you
t.you
I want to rename the files inside test.tgz to be:
0.foo
0.you
1.you
2.you
3.you
Without the use of extracting the files and repacking them. How could I accomplish this?
Even though you can't rename the files in the tar archive, you can rename them with a sed expression on the fly while they are being extracted. The option to tar is--transform [sed-expression].
You do need to extract the files before you rename them. When files are in a tgz, they are protected from change.

Sync zip file with folder?

I know specifying a zip file in the command add the files to the zip file itself, but how can I really sync a folder having already a zip file so that it does add new files, replace modified files and delete absent files in the folder?
The command-line "zip" tool has the -FS (or --filesync) flag that does exactly this (updates existing, adds new, deletes removed).
See http://www.info-zip.org/mans/zip.html.
The command-line "zip" command has options for --freshen (update existing files only), --update (update and add files), and --delete to remove, but I couldn't find a way to combine them all into one command.
Since the zip file probably needs to be completely rewritten during processing anyways, why not just delete the old zip file and create a new one from scratch?

Copy files excluding some folder in linux

I want to create script that copy my project and make it zip archive. I want to exclude all folder named .svn in all sub directories. Any suggestion?
I'd use rsync's FILTER RULES for this:
Create an .rsync-filter file (in the origin directory) containing, e.g.
-.svn/
Now run rsync like an exalted copy:
rsync -aFF origin/ destination/
You can do this using rsync. Although this is designed to synchronise directories across servers, it can also be used to copy directories on a single machine.
rsync has a --exclude option to exclude files and directories by pattern. See http://www.samba.org/ftp/rsync/rsync.html for help and examples.
Just call the zip utility on your project’s folder and use the -r option for recursive plus the -x option to exclude files / folders by pattern.
zip -r target-filename.zip source-folder -x \*exclude-pattern\*
exclude-pattern in your case would be .svn
See also man zip

How do you check what files are inside an NSIS setup.exe?

In my NSIS script, I use this line:
File "..\help\*.*"
My problem is that I have the help directory in my subversion repository (its constantly updated as we add new functionality). This means that the help directory contains a .svn directory.
I wish to view the contents of the setup.exe that NSIS created to verify that it does not have the .svn directory.
P.s. I experimented to see if NSIS recursively adds files when wildcards are used. It doesn't. But I want to verify this, hence the question.
These things are typically compressed files.
You could check with 7z/7-zip to open the EXE archive.
As a record, after the comments below,
I'd like to point to my recent notes on the merits of 7-zip at Superuser,
Compressing with RAR vs ZIP
Rather than look at what's in your NSIS exe itself, just exclude the .svn directories so you know they'll never be in there.
Something like this will do the trick:
File /r /x .svn "..\help\*.*"
The /x .svn bit tells NSIS to exclude those directories.
Coincidentally, if you're not using the /r switch, then you're not adding files and folders recursively, so it wouldn't add the .svn subdirectories anyway.
Instead of unzipping, my suggestion is to look at the NSIS compilation log. It will tell you everything about files included. When doing changes in my NSIS scripts I always check the logs to make sure that everything is going according to plan. Streaming the log from the command line to a text file, then read it from your favorite editor.
I use 7zip File Manager and the "Open Inside" command.

Resources