Compress a file with password- encryption not supported - encryption

I am going to compress some .csv file in one file, but I have to set password for this.
I have used zip -P password file.zip myfiles
but it gives me an error...
zip error: Invalid command arguments (encryption not supported)
I am working on Solaris machine.
Could someone help me about this?

I found the way
7z a -p[password] -r Fdirectory.7z /path/to/F

Related

Encrypt zip file in folder with PGP

I have been testing with PGP command line to create a batch file that encrypts all zip files in a folder
So far I have tried
GPG -e -r username c:\foldername*.zip
But when I run the bat file nothing happens.
Do I need the path to where PGP is installed adding?
I would also like to delete the zip once it’s encrypted and on a previous batch file used -SDEL, will this work here
Thanks
gpg doesn't seem to work file wildcards. You should use for cycle, see this answer for the examples: How to do something to each file in a directory with a batch script

Reading files present in a directory in a remote folder through SFTP

TLDR; Convert the bash line to download sftp files get Inbox/* to c++ or python. We do not have execute permissions on Inbox directory.
I am trying to read the files present in a directory in a remote server through SFTP. The catch is that I only had read and write permissions on the directory and not execute. This means any method that requires opening (cding) into the folder would fail. I need to read the file names since they are variable. From what I understand ls does not require execute privs. If I can get a list of files in the directory then reading then would be fine. Here is the directory structure:
Inbox
--file-a.txt
--file_b.txt
...
I have tried libssh but sftp_readdir required a handle of the open directory. I also looked at paramiko for python but that too requires to open the directory to read the file names.
I am able to do this in bash using send "get Inbox/* ${destination_dir}". Is there anyway I can use a similar pattern match but on c++ or python?
Also, I cannot execute bash commands through my binary. Does anyone know of any library in python or c++ (preferred) that would support this?
I have not posted here in a while so please excuse me if I am not following the formatting. I will learn from your suggestions. Thank you!

zip command in unix with wildcards

I am trying to zip file which is in the format of Amazon*.xls in unix and also remove the source file after compression.Below is the used command
zip -m Amazon`date +%Y-%m-%d:%H:%M:%S`.zip Amazon*.xls
For the above command i am getting below error
zip I/O error: No such file or directory
zip error: Could not create output file Amazon.zip
PS: GZIP is working fine. I need zip format files.
It is not the zip, it is how your shell deals with expanding/substituting variables. Two lines solution for bash
export mydate=`date +%Y-%m-%d:%H:%M:%S`
zip -m Amazon_$mydate.zip *matrix*
Execute by hand (few secs difference) or better put in a shell script myzipper.sh and just source it.
Use '-p' instead of '-m', if zip files are to be extracted on Windows OS.
export mydate=date +%Y-%m-%d:%H:%M:%S
zip -p Amazon_$mydate.zip matrix

When extracting a tar archive, I get the error "No such file or directory found"

When I attempt to extract a huge tar archive, I get the following error:
"filename: No such file or directory found"
Any suggestions on what could be going wrong?
This may happen if the disk is full. If you extract using:
tar -xvf <filename.tar>
you may see the following message before any No such file or directory found:
mkdir failed: Disk quota exceeded
why dont you try to test your tar file first!
file yourfile.tar
(it should say its a tar file if it's not broken)
Then...
tar -tvf yourfile.tar
It should give a listing of the contents of your tar file without actually writing it to disk. Just to check the integrity of it.
Also, if your file is larger tan 2GB it is posible that your tar binary wont work, try gtar instead!
with that info, you can go further...
regards,
Daniel.

Untar a UNIX-based operating system

I am trying to untar UNIX-based operating system from a .tar.gz file. In order to do so I use the following command:
tar -xvf rootfs.tar.gz -o
The -o flag is to not to preserve the ownership of the files (it gave some problems). The problem is that when a symbolic link is untared the following message shows up
Cannot create symlink to `toto': Operation not permitted
Moreover, mknod also gives problems
dev/tty0: Cannot mknod: Operation not permitted
I am in a FAT system. Does anyone know how to untar that file?
Thanks in advance
If the file is a tar.gz you must use:
tar -xvzf rootfs.tar.gz
And notice that a FAT filesystem doesn't support symbolic links, so it doesn't know how to make it on that FS, and it explains the Operation Not Permitted Error.
+1 fpr Ivan's answer
please note that:
flags always go right after the name of the command!
you will need to study "man tar" to see what other options you want, e.g. preserve owner, permissions, time-creation date, etc..
The correct answer is that if you're trying to untar a UNIX root file system, that's going to include special files such as device nodes (which is why tar is invoking mknod).
To create those successfully, tar must be allowed to run as root. Therefore, the correct answer is to use sudo, like so:
sudo tar -xvzf rootfs.tar.gz
Try this to untar a tar file. Hopefully it will work fine without any problem, as this one solved my issue
tar -xvvf foo.tar

Resources