I have a bitbucket repository, where we are building code and creating a zip after every checkin.
Script to create ZIP:
zip -r /usr/path/file.zip ./FOLDER
zip is being created perfectly, and the zipped file has cong file(test.conf). After zip file is created, formatting of test.conf is changed in zipped file. So code is not able to read data from zipped file. Is there any way to keep the formatting intact (as it is) in the zipped file as well?
In the zipped file all the CR = Carriage Return are removed. How I can keep that intact?
I have found the solution for above problem. I fixed the issue by adding .gitattributes file with below content in my git repository.
*.conf eol=crlf
Which means:
These files are text and should be normalized (Convert crlf => lf)
Exclude files from exporting ending with .conf.
Related
in Python I have the following command executed unzip '{dir}ATTOM_RECORDER/*.zip' -d {dir}ATTOM_RECORDER/ as a bash command. The python call works perfectly. my question is about the unzip command itself.
for some reason when unzip is called to expand any relevent zip files in the folder specified, not all the files WITHIN the zip is extracted. There's usually a rpt and a txt file. However, sometimes the txt file is not coming out and I do not have an error command.
How can I ensure the txt file is guaranteed to be extracted before moving on?
Thanks
While you want to unzip your specific zip file. There are many option to decompress any file from zip files. Easiest way is the ā-lā option with unzip command is used to list the contents of a zip file after extracting it.
Syntax: unzip -l [file_name.zip]
I currently have about 10 zip files I would like to extract into one folder. Each zip file contains around 1000 images. As a result, lots of the names of the images are duplicated. For example, in the first zip file, we have things like Img.jpg, Img(1).jpg, Img(2).jpg. I know that to extract multiple zip files into a single folder, I would do something like:
unzip '*.zip'
However, when it tries to put a file from the first zip file that has the same name as a file in the second zip file, it starts to ask:
replace duplicatefile.mp4? [y]es, [n]o, [A]ll, [N]one, [r]ename:
At this point, what do I do if I want to keep ALL files, including the duplicates, and possibly have them named to image(1).jpg instead?
In short, is there a way to call the unzip command on all the zip files, have them extracted into a single folder, without losing any files due to same names?
Thanks.
Invoke unzip --help for details.
But it appears unzip *.zip -n should do the trick?
(Make sure it does what you expect before going ahead!)
Does veracrypt do any sort of file caching in memory that might be preventing changes to my git config files to be recognized?
Long version: I have a repo on a veracrypt partition shared with Windows. While trying to enforce EOL's in my repo, I am seeing files more or less arbitrarily setting EOL's. When making a trivial change to my .gitattributes file, I'll merge this change onto a branch, and suddenly my new branch is filled with files with EOL-only changes.
I'm working on linux using mostly SmartGit or the cmd-line (git v 1.8.3.1). I've tried removed autocrlf and safecrlf or setting to false in both my global and repo config files in case they were confusing things. I've tried deleting my .gitattributes file, or setting
* binary
To prevent any conversion at all.
I have reset dozens of times, and deleted my local repo and re-cloned. But I cannot get rid of these modified files
git rm --cached -r .
git reset --hard
Below is my .gitattributes
# Auto detect text files and perform LF normalization
* text=auto
# Specify LF file endings for coding files
*.txt text eol=lf
*.c text eol=lf
*.cpp text eol=lf
*.h text eol=lf
*.py text eol=lf
*.kl text eol=lf
*.json text eol=lf
# Specify windows-only CRLF endings
*.bat text eol=crlf
*.vcproj text eol=crlf
*.sln text eol=crlf
# Specify binary files - do not modify these files, dammit!
*.so binary
*.dll binary
*.lib binary
*.pdb binary
*.exp binary
*.exe binary
My major problem is that some (not all) .so symlinks are showing up modified in one particular branch - looking for all the world like they've been converted. This consistently occurs in my latest branch, but not earlier branch. In the current spate of madness, my last merge added the *.cpp tag, which promptly converted some (not all) of my *.py files to windows line endings.
Has anyone experienced this kind of unreliability? Is the .gitattributes file supported in this version of git? Is veracrypt or the NTFS partition somehow confusing things on me?
I've been working on what should be a trivial task for a week now, and simply cannot fathom how git is deciding on its EOL strategy.
I still don't know precisely what is going wrong, but I recreated the repo, and as long as I never touch (use it read-only) it in windows it seems ok.
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.
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?