473,472 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to list only files (not path) in directory with .pl extension

82 New Member
Hi, I'm trying to list files in a different directory based on a specific criteria.
The directory is in Dir1 and I'm in HOME.
I would like to only list files that end in .pl

However, I do not want to include the file path in the result.

In short, I want to ls Dir1 but only list file names that end in .pl.


Any suggestions?
Apr 4 '13 #1
2 1589
sicarie
4,677 Recognized Expert Moderator Specialist
Move into the directory first, then list

Expand|Select|Wrap|Line Numbers
  1. cd Dir1; ls *.pl
  2.  
Apr 5 '13 #2
Nepomuk
3,112 Recognized Expert Specialist
You can automatically move back to the previous directory with the following line of commands:
Expand|Select|Wrap|Line Numbers
  1. PWD_old=`pwd`; cd Dir1; ls *.pl; cd $PWD_old
Apr 29 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
54
by: seberino | last post by:
Many people I know ask why Python does slicing the way it does..... Can anyone /please/ give me a good defense/justification??? I'm referring to why mystring gives me elements 0, 1, 2 and 3...
1
by: James White | last post by:
I have a young nephew who appears to be developing into a natural geek/nerd/guru/whatever and as he learns I need to make sure that he stays on the side of the white hats, rather than going down...
1
by: Manuel11g | last post by:
Hello, I am a new programmer in Python and a need some help. Where can i get a basic tutorial about Class. I don't know nothing about Object Oriented Programming. Can you help me?
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
6
by: Simon Walsh | last post by:
I'm an Electronics student in college and I'm currently working on a project. I was given a circuit diagram for my project, from which I had to design a printed circuit board to be sent off and...
28
by: Randy Reimers | last post by:
(Hope I'm posting this correctly, otherwise - sorry!, don't know what else to do) I wrote a set of programs "many" years ago, running in a type of basic, called "Thoroughbred Basic", a type of...
1
Lokean
by: Lokean | last post by:
Hi. I have a vb.net program that hits a database and returns a dataset which I use in a datagrid for display purposes. I also want to output the dataset to a crystal report. I have used the...
1
by: Tony Johansson | last post by:
Hello! I'm reading a book and I'm trying to learn the very basic about xml. Can somebody give me an explanation why namespace are used in xml perhaps with a simple example that demonstate the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.