for i ...  strip filename and make dir

Posted on 2006-04-30
Last Modified: 2008-03-06

I have to dirs:


In dir1 there are a lot of filexxxxxx.tar.gz files

when I do a "for i ..." and $i contains everytime one path+filename for example: /full/path/filename30.tar.gz
I need to make in dir for each file a directory, for example mkdir filename30.

Best regards,

Question by:harryv
    1 Comment
    LVL 48

    Accepted Solution

    It would have been useful to show the actual loop you are using.

    Anyway, to make a directory from the full filename, do:

    mkdir `basename $i | sed "s/\..*//"`

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
    The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now