Sponsored Content
Top Forums UNIX for Dummies Questions & Answers command to get count in unzipped folder Post 302141048 by porter on Wednesday 17th of October 2007 12:28:50 PM
Old 10-17-2007
Code:
man test

...

    -r file       True if file exists and is readable.

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

zipped or unzipped file

Is there a way you can tell if a file is still zipped or it's unzipped I have a file called ssss.zip and I would like to know if this file is still zipped or if it's unzipped? I'm on IBM AIX/RS6000 (3 Replies)
Discussion started by: ted
3 Replies

2. UNIX for Dummies Questions & Answers

Zip command (zip folder doesn't include a folder of the same name)

Hi guys, I have a question about the zip command. Right now I have a directory with some files and folders on it that I want to compress. When I run the zip command: zip foo -r I am getting a foo.zip file that once I unzip it contains a foo folder. I want to create the foo.zip, but that... (1 Reply)
Discussion started by: elioncho
1 Replies

3. UNIX for Dummies Questions & Answers

See the date of file after its been zipped and unzipped?

I have some log files that have been gzipped and then compressed using cpio. There are a number of log files that have been compressed to the one file. When I extract them the date of the file when doing an ls -la is today's date (the date I extracted them). Is there anyway to see the date... (3 Replies)
Discussion started by: Sepia
3 Replies

4. Shell Programming and Scripting

Count matching filenames in a folder

Hi all, I have 4 files for example named abc01012009.txt abc02012009.txt abc03012009.txt abc04012009.txt in a folder. I would like to firstly backup the latest file available, in this case, the latest date available, abc04012009.txt to its subfolder named backup, and then rename the... (4 Replies)
Discussion started by: tententen
4 Replies

5. UNIX for Dummies Questions & Answers

How to obtain a count of files in a folder and it's subfolders

First of all, the extent of my unix knowledge is next to nil. I've been able to telnet to a unix box, and thanks to the Computer Hope website, I've been able to learn a few basic commands to navigate from folder to folder, and view contents. What I really need to do is obtain a count of all... (2 Replies)
Discussion started by: scarfinv
2 Replies

6. UNIX for Dummies Questions & Answers

Separate text files in a folder by word count

Hi, been searching Google for like an hour and I doubt I got the right keywords so might as well ask here. What I need: Before: Article1.txt 564 Article2.txt 799 Article3.txt 349 Article4.txt 452 * Separate files over 400 wordcount * After: Article1.txt 564... (3 Replies)
Discussion started by: Richard2000
3 Replies

7. Shell Programming and Scripting

Get the file count in a folder

What is the best way to get the file count (Including the subdirectories) under a folder? (12 Replies)
Discussion started by: un1xl0ver_rwx
12 Replies

8. Shell Programming and Scripting

Renaming unzipped files with name of archive

I am attempting to rename files within a zipped archive with the beginning of the name of the zip file. For example unzip AAA_000.zip and rename file1.csv, file2.txt to AAA_file1.csv, AAA_file2.txt. I am able to do this for a zip file with one file inside, but not for multiple files. This is... (2 Replies)
Discussion started by: lcp
2 Replies

9. UNIX for Dummies Questions & Answers

Adding unzipped files to a Zip

Hey all, I have a zip file which I received, and I need to replace one of the files inside of it. I tried the obvious solution of unzipping the zip, replacing the file, and rezipping, but the following happened: Original Zip Size: 79MB Unzipped Size 80MB New Zip: 36MB When I feed the... (2 Replies)
Discussion started by: DeanLeitersdorf
2 Replies

10. UNIX for Advanced & Expert Users

Searching for file types by count in specific folder in RHEL 6

So I'm trying to search for the top 10 or 15 items under a directory by file type. I want to run a command on a directory and get something like the following: Example of expected output.. .PDF: 100, .txt: 95, .word: 80.. What would be the best way of going about this? I've searched around... (2 Replies)
Discussion started by: shackle101
2 Replies
test(1F)							   FMLI Commands							  test(1F)

NAME
test - condition evaluation command SYNOPSIS
test expression expression DESCRIPTION
test evaluates the expression expression and if its value is true, sets a 0 (TRUE) exit status; otherwise, a non-zero (FALSE) exit status is set; test also sets a non-zero exit status if there are no arguments. When permissions are tested, the effective user ID of the process is used. All operators, flags, and brackets (brackets used as shown in the second SYNOPSIS line) must be separate arguments to test. Normally these items are separated by spaces. USAGE
Primitives The following primitives are used to construct expression: -r filename True if filename exists and is readable. -w filename True if filename exists and is writable. -x filename True if filename exists and is executable. -f filename True if filename exists and is a regular file. -d filename True if filename exists and is a directory. -c filename True if filename exists and is a character special file. -b filename True if filename exists and is a block special file. -p filename True if filename exists and is a named pipe (FIFO). -u filename True if filename exists and its set-user-ID bit is set. -g filename True if filename exists and its set-group-ID bit is set. -k filename True if filename exists and its sticky bit is set. -s filename True if filename exists and has a size greater than 0. -t[fildes] True if the open file whose file descriptor number is fildes (1 by default) is associated with a terminal device. -z s1 True if the length of string s1 is 0. -n s1 True if the length of the string s1 is non-zero. s1 = s2 True if strings s1 and s2 are identical. s1 != s2 True if strings s1 and s2 are not identical. s1 True if s1 is not the null string. n1 -eq n2 True if the integers n1 and n2 are algebraically equal. Any of the comparisons -ne, -gt, -ge, -lt, and -le may be used in place of -eq. Operators These primaries may be combined with the following operators: ! Unary negation operator. -a Binary and operator. -o Binary or operator (-a has higher precedence than -o). `(expression)` Parentheses for grouping. Notice also that parentheses are meaningful to the shell and, therefore, must be quoted. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
find(1), sh(1), attributes(5) NOTES
If you test a file you own (the -r , -w , or -x tests), but the permission tested does not have the owner bit set, a non-zero (false) exit status will be returned even though the file may have the group or other bit set for that permission. The correct exit status will be set if you are super-user. The = and != operators have a higher precedence than the -r through -n operators, and = and != always expect arguments; therefore, = and != cannot be used with the -r through -n operators. If more than one argument follows the -r through -n operators, only the first argument is examined; the others are ignored, unless a -a or a -o is the second argument. SunOS 5.11 5 Jul 1990 test(1F)
All times are GMT -4. The time now is 09:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy