Unix command: remove a dir containing files

If rmdir deletes an empty directory, which command could I use to remove one containing files?

iBertus wrote:
deficite wrote:
Try just using -r. I do it all the time and never get any errors. Like if I were to delete /:
rm -r /
Geez... not sure I'd use that example  :twisted:  :twisted:  :twisted:
LOL, ditto!

Similar Messages

  • Unix command to make list of file name

    Hi Gurus,
    I have seen post how to process multiple file from johngoodwin.blogspot.com.
    But what is the equlivalent command in unix to list all file names.
    I want one text file will contain all text file name and another text file will contain all csv filenames.
    Need some suggestion.Please help.
    Thanks in advance.

    Hi please follow below steps.
    vi yourfilename.sh
    then in edit mode put your command
    then save it by pressing esc : q (escape colon q)
    Now your file will be there. just run that script file in OS Command.But that file should be accessible or else give the full path for that script file.
    Thanks

  • Unix command in FTP connection through File Adapter

    Hi All,
    I have a scenario IDOC to file in which the user requested for pushing file to FTP server as below
    put localfilename %localfilename%CITISECUFLATNA%CITIGPASSIN%%B
    Here my file name is test.txt.
    so I tried giving in communial channel as
    File Access Parameters
    Target Directoy      : put test.txt %test.txt%CITISECUFLATNA%CITIGPASSIN%%B
    File Name Scheme: text.txt
    But I go the error in Communication channel as
    An error occurred while connecting to the FTP server 'ftp-gw.dx.deere.com:21'. The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: 501 Syntax errors in parameter.     usage: %[recipient id]%[APRF]       where either [recipient] or [APRF] can be omitted.            (to change your current default SEND relationship).            %% (places you in your 'HOME' TR).   &['s'|'single'] ('get' command gets single file).   &['m'|'multiple'] ('get' command gets multiple files). '. For details, contact your FTP server vendor
    Please let me know how we can specify in our FTP parameter in Communication chanel.
    Regards,
    Dhill.

    Hi Satish,
      Thank you very much for your help and your time.  But I tried as you told
    Target Directory as : \
    File name scheme : test.txtCITISECUFLATNA%CITIGPASSIN%%B
    and also tried as
    Target Directory as : \
    File name scheme : test.txt<b>%</b>CITISECUFLATNA%CITIGPASSIN%%B
    still i got the same eror....  I am getting success only when I specify like
    Target Directory as : %%
    File name scheme : test.txt
    but the vendor is saying he is not able to see the file anywhere in ftp.
    Regards,
    Dhill

  • Unix command to delete range of files

    Hi
    I need to delete the files including and between these file numbers:
    P0001665877.dbf . . . and P0001665985.dbf
    Is this the correct command?:
    rm P0001665[8-9]*.dbf
    or should it be this:
    rm P0001665[8-985]*.dbf
    Thanks in advance.
    AIX 5.2

    Fred is trying to match all the conditions,
    you mentioned you need to delete all filename between P0001665877.dbf and P0001665985.dbf
    You need to wrap your example by code, we can't tell the exact command you posted, it was parsed a little by forum.

  • How to generate a empty file in AL11 using ABAP and unix command

    Hi Experts,
    when load infopackage triggers it will search file from AL11 if file is available it will get loaded successfully.  When there is no file in AL11 error while opening file (orgin A) and the load will fail.  At this level i have to write a abap code using unix command to generate a empty file.
    Is there any way to achieve the above requirement.
    Thanks
    Vara

    Hi,
    If i get your requirement properly then you want to create a blank file if there is no file on the application server so that your infopackage does not fail, am i correct.
    If this is your requirement then this can be easily done if you use process chain to load the file via infopackage. Follow the following steps:
    1. Add a ABAP program before the infopackage and check if the file is present on the server or not. Use a simple ABAP statement OPEN DATASET <FNAME>. Check the SY-SUBRC after this statement if it is not 0 then it means that the file does not exist on the application server.
    2. Once you have established that the file is not present create a flat file using a code similar to the below one
    OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
                          MESSAGE D_MSG_TEXT.
    IF SY-SUBRC NE 0.
      WRITE: 'File cannot be opened. Reason:', D_MSG_TEXT.
      EXIT.
    ENDIF.
    * Transferring Data
    LOOP AT INT_table.
      TRANSFER INT_table-field1 TO FILENAME.
    ENDLOOP.
    * Closing the File
    CLOSE DATASET FILENAME.
    3. Add your infopackage step after this ABAP program in your process chain.
    I hope this helps.
    Best Regards,
    Kush Kashyap

  • Unix command to find certain files

    hello,
    i have a powerbook g4 running leopard... i want to find all files related to a certain program or app. What would the unix command be to find all files related to a certain program or app.
    Also... is there unix commands to find all related preferences or cached items?
    Any help would be great.

    find / -name "*.doc"
    where "*.doc" would find all files ending in .doc
    and / is the root (top most) directory. You may specify a different starting point
    find $HOME -name "*.pdf"
    or even multiple starting directories
    find ~username1 ~username2 ~username3 -name "*.zip"
    You may specify more than one type of file to locate
    find $HOME \( -name "*.dmg" -or -name "*.plist" \)
    You may also want to look at the xargs command, as well as find's "-print0" option and xargs' "-0" option
    find $HOME -name "*.txt" -print0 | xargs -0 grep "magic"

  • Unix command for turning file sharing off

    Is there a Unix command I can use to turn off file sharing on Leopard ( as well as Tiger ) laptops? I don't mean a command to kill it for the session, I need it off even if the system is restarted. Yes, I can do it though the Preferences, but I need to do it to over 200 some laptops. We have ARD and if we had a Unix command to send to turn file sharing off that would be helpful. Thank you.

    There is a CLI for just about everything. From the [OS X Leopard Security Configuration Guide|http://images.apple.com/server/macosx/docs/LeopardSecurity_Config20080530.pdf]:
    To disable FTP.
    launctl unload -w /System/Library/LaunchDaemons/ftp.plist
    To disable SMB.
    defaults delete /Library/Preferences/SystemConfiguration/com.apple.smb.server EnabledServices
    launctl unload -w /System/Library/LaunchDaemons/nmbd.plist
    launctl unload -w /System/Library/LaunchDaemons/smbd.plist
    To disable AFP.
    launctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist

  • Working Code from Unix Command, needs fixing!

    /* Codes needs modification to run and display in GUI, will run and produce output in terminal, but will not display in GUI with setText and getText */
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class UnixCommand extends JFrame
    private JComboBox comboBox;
    private JTextArea displayArea;
    private JPanel mainPanel, displayPanel, comboPanel;
    private String names[] = { "Check Processes", "Check Network Connectivity",
                        "Check Remote Users", "Check Share Devices" };
    TitledBorder selectBorder, displayBorder;
    public UnixCommand()
         super( "Unix Command Tools in GUI" );
         Container container = getContentPane();
         mainPanel = new JPanel( new BorderLayout() );
         container.add( mainPanel );
         displayPanel = new JPanel();
         comboPanel = new JPanel();
              mainPanel.add( displayPanel, BorderLayout.CENTER );
              mainPanel.add( comboPanel, BorderLayout.NORTH );
                   comboBox = new JComboBox( names );
                   comboBox.setMaximumRowCount( 3 );
                   comboPanel.add( comboBox );
                        selectBorder = BorderFactory.createTitledBorder( "Select the Task to Perform" );
                        selectBorder.setTitlePosition( TitledBorder.TOP );
                        comboPanel.setBorder( selectBorder );     
                   displayArea = new JTextArea( 22, 40 );
                   displayPanel.add( displayArea );
                        displayBorder = BorderFactory.createTitledBorder( "The Command Output Selected" );
                        displayBorder.setTitlePosition( TitledBorder.BOTTOM );
                        displayPanel.setBorder( displayBorder );
    String s = null;
         displayArea.setText("\tHere is the standard output of the command:\n");
    try
                             // run the Unix "ps -ef" command
    Process p = Runtime.getRuntime().exec("ps -ef");
    BufferedReader stdInput = new BufferedReader(new
    InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new
    InputStreamReader(p.getErrorStream()));
                        // read the output from the command
    System.out.println("Here is the standard output of the command:\n");
    while ((s = stdInput.readLine()) != null)
    System.out.println(s);
                        // read any errors from the attempted command
    System.out.println("Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null)
    System.out.println(s);
    System.exit(0);
    catch (IOException e)
         System.out.println("exception happened - here's what I know: ");
         e.printStackTrace();
         System.exit(-1);
    setSize( 500, 500 );
    setVisible( true );
    public static void main( String args[] )
         UnixCommand application = new UnixCommand();
         application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    }

    All files are regenerated if changed.
    That goes for the .java and the .class files that are created. The jsp server checks to see if the current version is the latest. If it is, nothing gets changed or recompiled. If things are different, programs are recompiled.
    Youll notice that if you have a new jsp it always takes longer the first time. Or even when you change a jsp, the first time takes the longest for the page to come up in a browser. This is because of recompiling.
    Does this make any sense?
    Adam

  • Unix Command to Move Folders back into Directory

    As you can see from my previous thread: https://discussions.apple.com/thread/3138884?tstart=0
    I ended up reinstalling Mac OS X 10.6.0 after using "mkdir" and "mv" Unix commands to move my old files to a "previous" folder and I'm still trying to access my account because it's Vile Vault protected. I wish I knew how to move my old folders out from previous into /volumes/macintosh\ HD
    Basically it looks like this right now
    ~/Volumes/Macintosh/HD\ Previous (I'm not even sure if that's written the right way
    I need to move all of the folders out from Previous into ~/Volumes/Macintosh\ HD and deleting the existing ones in it.
    All I want to do is have my old Kernel Panic back because I know how to fix it now.
    Thank you very much!

    Hi Philip
    Philip Han wrote:
    I honestly despise the forum setup... Whenever I wait too long the cursor loses focus so when I hit backspace I go back a page and lose everything I wrote. This has happened to me on 3 different computers now.
    I don't have this problem at all, and I can't make any suggestions on how to fix it.  Maybe you should post a separate thread in the Using the Forums Forum.
    So in the end I went against your advice and moved Applications and Users back to their original folder in HD and I logged in just fine! Well, I did have to boot into single user mode to restore Admin Privileges by creating a new account and then changing Privileges. Some programs didn't start up but it's okay, I know which ones rely on System and whatnot but at least I have nearly everything in its original place and I can back it all up.
    Ahh, you're made of sterner stuff than me !
    Best Buy has $99 1TB WD Passport SE's (The USB 3.0 Version actually!) so I grabbed one immediately and set up Time Machine.
    Sounds like a good choice. 
    Seriously, what other way can you ensure that your data is safe without using File Vault? I use Truecrypt for some things that I don't access much, but daily operations? I'd rather just put up with the sluggish performance of FV!
    I think it depends on what level of security you need. Do you routinely have files that simply must not be read by a third party if your computer gets stolen? 
    FV has always struck me as a hammer to crack a nut, and if something goes wrong you can't even take the disk to a data recovery specialist to get your information back.
    On occasions when I have data that must be kept secure I use Disk Utility to set up an encrypted sparse bundle, which I keep on the desktop. When I need to access files in the bundle then I double click on it and enter the password to mount it.  A minor problem with this is that TM will copy across the whole sparse bundle even if just one file on it is edited. Even so, it's not really a problem since TM is working in the background.
    Thank you for all your help Bob!
    You're most welcome
    Bob

  • Need a unix command

    Hi all,
    I just can't figure this out... I need a unix command that will backup any file matching a specific file extension AND the directory structure those files are in into a separate directory or volume. In other words, let's say that I have the files and directory structure below. I want to backup all of the txt files as separate files (not a tar archive) without writing the img files, without overwriting one txt file with another, and preserving the directory structure.
    foo/bar/a.txt
    foo/bar/b.txt
    foo/bar/a.img
    foo/bar/b.img
    foo/me/a.txt
    foo/me/b.txt
    foo/me/a.img
    foo/me/b.img
    foo/me/you/a.txt
    foo/me/you/b.txt
    foo/me/you/a.img
    foo/me/you/b.img
    I've read the man pages for ditto and rsync... they're geared toward backing up every file in a directory, and so they're not very clear about how to backup one single file type/extension.
    Everytime I try different varients of the rsync command, I either get errors "rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-24.1/rsync/main.c(717)", or file not found, or it overwrites the 'a.txt' with a different 'a.txt' without preserving the directory structure.
    Can someone give me the exact syntax for backing up the .txt files in the example above to an external disk (e.g. /Volume/backup)???
    Thanks!

    OK... my example was oversimplified. There are tons of different types of files in my directories (*.img, *.gif, *.etc), and I only want to cp one type (e.g., .txt).
    So, I started with the --include flag using the following command:
    rsync -nav --include *.txt foo/ /Volumes/baz/
    the result listed every file in foo (e.g., *.txt, *.img)
    I thought that perhaps the \*.txt should be *.txt
    rsync -nav --include *.txt foo/ /Volumes/baz/
    the result listed every file in foo (e.g., *.txt, *.img)
    rsync -nav --include "*.txt" foo/ /Volumes/baz/
    again, the result listed every file in foo (e.g., *.txt, *.img)
    Clearly, the --include flag wasn't working as I expected it to work. So, I decided to try the --exclude flag:
    rsync -nav --exclude "*.img" foo/ /Volumes/baz/
    Now, the results listed every file in foo except the *.img files.
    I needed to exclude other files as well, so I tried:
    rsync -nav --exclude "*.img *.etc" foo/ /Volumes/baz/
    Now, the results listed every file in foo INCLUDING the *.img files. So, adding additional file types within quotes broke the original command.
    rsync -nav --exclude *.img *.etc foo/ /Volumes/baz/
    Now, I get the error "rsync: link_stat "/Volumes/HD/foo/*.etc" failed: No such file or directory (2)"; and all .etc files are still included
    Now I tried:
    rsync -nav --exclude *.img --exclude *.etc foo/ /Volumes/baz/
    Now, this excluded both *.img and *.etc files. I have about 20 file types other than *.txt ... there has to be some other way!!!
    PowerMac Dual 2.7GHz G5 Mac OS X (10.4.9) 4.5GB RAM

  • What Unix command is used to assert a file or folder's color label assignment?

    I'm doing some scripting to automate processes on my XSan.  One of the functions I find I'm doing over and over frequently is changing file ownership, permissions, changing the color of the parent folder based on the status of the files in it, and then locking the file.  I know the UNIX equivalents for three of the four commands:
    chown-- for the file ownership
    chmod-- for the permissions
    chflags-- for the lock bit
    but I've been looking through man pages all day and can't find what command asserts the file or folder's "label" color attribute.  I'd rather do this in command line that in Automator, as it's faster and I have hundreds of folders containing files that I need to lock down.  My boss is considering replacing XSAN with Compellent, and I'm trying to show how easy MacOS is to manage when you can script everything involved in maintaining it.  This will go a long way towards making that case.

    Wrong forums. Try https://discussions.apple.com/community/mac_os/mac_os_x_technologies#/?tagSet=10 48

  • Unix command in ARD to remove DNS Servers from Network prefs?

    I need to know how to send a unix command to remove DNS Servers in Network preferences. I need the DNS Servers field to be blank. Can this be done?

    Our network administrator is getting ready to change the IP address of our DNS server. This means I have over 30 Macs that will be needing changes to their DNS settings. Since each machine is setup with limited access to the system prefs, that means I have to go to each machine and log in as the admin user to make this change. In the interest of saving time, is this something I can do with Remote Desktop and how? Would I use the same commands in this post and replace dns1 with our DNS' new IP address? Will this distrupt the users access to the network when I do so?
    Thanks for any help.
    Beth

  • Using UNIX command to copy desktop files/folders

    Hello All. I need help using UNIX command(s) to copy text documents and or folders from my lab computers to my desktop at home. Since I have such a slow connection, I think this will work best. I need help with the cp command and the path mostly. Since all files would be in folders on the desktop (including documents (that "missed" the folders), I believe I could simply copy desktop contents? Thanks, J Langlois

    What you want to do is SCP (secure copy) your documents to your remote host.
    send this command to the computer with the documents
    scp ~/Desktop/FILEOR_FOLDERNAME USERNAME@REMOTE_COMPUTER:~/Desktop/
    Replace all the stuff in UPPERCASE with the correct vales for your situation.
    Mini (Intel Core Duo)   Mac OS X (10.4.8)  

  • Unix Command to search file

    Hi
    Can anyone tell me how to get filename from server using
    UNIX command in ABAP program.I have requirement to search file in server using date criteria.
    should i use 'FIND' command to search file??
    Plz do needful..

    You need to use SM69 to define command and use it in your report.
    Regards,
    Christophe

  • Unix command to delete files with .cache extension

    I was wondering if anyone knew of a unix command that can be sent to another computer that will delete all files on the hard drive with a certain extension such as .cache.
    Like: rm *.cache
    Thank you!

    Well, I don't recommend it, but if you want to fubar the computer, send this as root:
    find / -name "*.cache" -exec rm -f {} \;

Maybe you are looking for

  • Error in OBIEE integration in ADF

    Hi, I am trying to connect to obiee 11g using presentation services using Jdev 11.1.1.5. When I tried to connect the OBIEE on my own PC, everything is fine. By when I tried to connect to the OBIEE remote on a server, an error occurs: The connection w

  • Lightroom slideshows in dreamweaver

    I'm new to Lightroom. After creating a slideshow, how can I use it in my website in Dreamweaver?

  • Photo stream doesn't work on my PC and keeps turning off

    Can any one resolve the following problem? Updated to latest version of iCloud for PC..initially worked with previous version for about a week then stopped working. Ta Keith

  • Permissions in Library

    I've been having a few issues since I changed permissions in the Prefrences folder of my Library (in my account only). I think (but I'm not positive), some of the issues I've had in the last few weeks may be related. Before I did it, the program Gara

  • 8i temp tables

    We are converting from Informix 7 to Oracle 8i. We are trying to emulate the Informix version as much as possible, using sql create global temporary table for a large number of temp tables in the app. Since the created table name spans sessions for a