Sponsored Content
Full Discussion: Help With zipping a file
Top Forums UNIX for Dummies Questions & Answers Help With zipping a file Post 302614319 by vbe on Wednesday 28th of March 2012 11:53:40 AM
Old 03-28-2012
I dont understand : If you move your file from dir1 to dir2, your file will be in dir2... since you have done nothing to the file but to move it, it has not reason to change...
Code:
ant:/home/vbe $ cd wks/dir1
ant:/home/vbe/wks/dir1 $ bdf>bdf.txt
ant:/home/vbe/wks/dir1 $ ll
total 8
drwxrwxr-x   2 vbe        bin             96 Mar 28 17:43 .
drwxr-xr-x   6 vbe        bin           2048 Mar 28 17:41 ..
-rw-rw-r--   1 vbe        bin           1888 Mar 28 17:44 bdf.txt
ant:/home/vbe/wks/dir1 $
ant:/home/vbe/wks/dir1 $ mv bdf.txt ../dir2/.
ant:/home/vbe/wks/dir1 $ ll
total 4
drwxrwxr-x   2 vbe        bin             96 Mar 28 17:45 .
drwxr-xr-x   6 vbe        bin           2048 Mar 28 17:41 ..
ant:/home/vbe/wks/dir1 $ cd ..;ll -ld dir*
drwxrwxr-x   2 vbe        bin             96 Mar 28 17:45 dir1
drwxrwxr-x   2 vbe        bin             96 Mar 28 17:45 dir2
ant:/home/vbe/wks $ ll dir2
total 8
drwxrwxr-x   2 vbe        bin             96 Mar 28 17:45 .
drwxr-xr-x   6 vbe        bin           2048 Mar 28 17:41 ..
-rw-rw-r--   1 vbe        bin           1888 Mar 28 17:44 bdf.txt
ant:/home/vbe/wks $ mv dir2 dir1/.
ant:/home/vbe/wks $ r ll
ll dir2
dir2 not found
ant:/home/vbe/wks $ ll -ld dir1/*
drwxrwxr-x   2 vbe        bin             96 Mar 28 17:45 dir1/dir2
ant:/home/vbe/wks $ ll dir1/dir2
total 4
drwxrwxr-x   2 vbe        bin             96 Mar 28 17:45 .
drwxrwxr-x   3 vbe        bin             96 Mar 28 17:45 ..
-rw-rw-r--   1 vbe        bin           1888 Mar 28 17:44 bdf.txt
ant:/home/vbe/wks $
ant:/home/vbe/wks $ uname -ms
HP-UX 9000/800

 

10 More Discussions You Might Find Interesting

1. AIX

Limitations of a file size for zipping

what is the maximum file size that i can zip in aix. (1 Reply)
Discussion started by: ramky79
1 Replies

2. UNIX for Advanced & Expert Users

Help me While zipping the file

Hi , I have written code which will ask the subject,body of the mail, attachment and mail id of the receipient. Code will pick up 4 files zip it. It will zip all the files and then post the mail to the receipient. While zipping the file i am getting error. Can anyone help me with this. ... (7 Replies)
Discussion started by: Jolly
7 Replies

3. Shell Programming and Scripting

Script for zipping a file

HI, I want a script which creat a zip file folder of files older than 15 days....... please help me on this........... (4 Replies)
Discussion started by: jayaramanit
4 Replies

4. UNIX for Dummies Questions & Answers

zipping all the tar files to singlr file in directory

Hi, i have more than 300 tar files in directory and i want to zip all tar files to single file. could anybody tell me the command since i know how to do zip for single tar file: bash-3.00$gzip 2008_11_10.tar bash-3.00$ pwd /oracle1/archivebackup in this directory i have lot files... (2 Replies)
Discussion started by: prakash.gr
2 Replies

5. Shell Programming and Scripting

zipping a directory when the file count is over $X

Hiya, I've been plugging away at this script and I cant get it to behave as I need. first off it fails to adhere to the conditions of the file limit, and zips the directory regardless of the file count and secondly, but less important it zips up the entire path not just the directory I'm... (2 Replies)
Discussion started by: orionrush
2 Replies

6. Shell Programming and Scripting

Zipping of file in a different directory

Hi, I am having some problem with a shell script which zip some files. For zipping I have used the following command: find . -name "Test_*" -mtime 0 | zip Test_$(date +"%Y%m%d") -@ I have kept the script in /home/abc directory. It is creating the zip file within the same directory where i... (2 Replies)
Discussion started by: abhishek_510
2 Replies

7. Shell Programming and Scripting

grep a file and zipping it

Hi, In my process iam creating a temporary filelist with filename and date(yyyy-mm-dd format).I need to search file for a date and zip. Below command is giving the filename ,can someone helpme how to add the zip or gzip command to this statement. grep 2010-11-11 filelist.log | awk... (1 Reply)
Discussion started by: swathich
1 Replies

8. UNIX for Dummies Questions & Answers

Zipping the file when moving

Hi, I have a file a.txt, I am moving the file from my source location (/root/onw/src) to target folder(root/byl/src). My target folder has already a file by name a.txt..,while moving can I see if this file a.txt is existing then move it to archive folder(/root/byl/arc) zip and add time stamp to... (2 Replies)
Discussion started by: shruthidwh
2 Replies

9. Shell Programming and Scripting

Error in Zipping a file

Hi I am trying to create a zip file of a csv by running below script. zip -r Daily_DB_`date '+:%d/%m/%y'` DBA_checks.csv But I am getting below error zip I/O error: No such file or directory zip error: Could not create output file (Daily_DB_:02/11/12.zip) However when I run below... (1 Reply)
Discussion started by: sv0081493
1 Replies

10. Shell Programming and Scripting

Zipping file issues

Hi All, I am trying to zip a file but facing the issue. I have three zip files. a_1.zip a_2.zip c.zip I want to add a_1.zip and a_2.zip to c.zip Code: ############### for i in a*.zip; do printf "%s\n" "$i" done | zip -@ c.zip (2 Replies)
Discussion started by: weknowd
2 Replies
scandir(3)						     Library Functions Manual							scandir(3)

NAME
scandir, alphasort - Scans or sorts directory contents LIBRARY
Standard C Library (libc.a) SYNOPSIS
#include <sys/types.h> #include <sys/dir.h> int scandir ( char *dir_name, struct dirent * (*name_list[ ]), int (*select) ( struct dirent *dir ), int (*compare) ( struct dirent **dir1, struct dirent **dir2 ) ); int alphasort ( struct dirent **dir1, struct dirent **dir2 ); PARAMETERS
Points to the directory name. Points to the array of pointers to directory entries. Points to a user-supplied function that is called by the scandir() function to select which entries to include in the array. Points to a user-supplied function that sorts the completed array. Points to a dirent structure. Points to a dirent structure. DESCRIPTION
The scandir() function reads the directory pointed to by the dir_name parameter. It then uses the malloc() function to create an array of pointers to directory entries. The scandir() function returns the number of entries in the array and, through the name_list parameter, a pointer to the array. The select parameter points to a user-supplied function that the scandir() function calls to select which entries to include in the array. The selection routine is passed a pointer to a directory entry and returns a nonzero value for a directory entry that is included in the array. If the select parameter is a null value, all directory entries are included. The compare parameter points to a user-supplied function that is passed to the qsort() function to sort the completed array. If the compare parameter is a null value, the array is not sorted. The memory allocated to the array can be deallocated by freeing each pointer in the array, and the array itself, with the free() function. The alphasort() function alphabetically compares the two dirent structures pointed to by the dir1 and dir2 parameters. This function can be passed as the compare parameter to either the scandir() function or the qsort() function. A user-supplied subroutine may also be used. RETURN VALUES
The scandir() function returns -1 if the directory cannot be opened for reading or if the malloc() function cannot allocate enough memory to hold all the data structures. If successful, the scandir() function returns the number of entries found. The alphasort() function returns the following values: Less than 0 (zero): The dirent structure pointed to by the dir1 parameter is lexi- cally less than the dirent structure pointed to by the dir2 parameter. 0 (zero): The dirent structures pointed to by the dir1 parameter and the dir2 parameter are equal. Greater than 0 (zero): The dirent structure pointed to by the dir1 parameter is lexically greater than the dirent structure pointed to by the dir2 parameter. RELATED INFORMATION
Functions: malloc(3), opendir(3), qsort(3) delim off scandir(3)
All times are GMT -4. The time now is 02:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy