Find the answer to your Linux question:
Results 1 to 3 of 3
Hello im new in Programming and i have question to users of this forum. is there anyway to delete all files in folder via shell_exec(); or bash if yes can ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    2

    [help]Delete All Files from folder. & adding user via php

    Hello im new in Programming and i have question to users of this forum.

    is there anyway to delete all files in folder via shell_exec(); or bash

    if yes can anyone write example for me.

    adding user via php i made code like

    <? shell_exec('useradd -q -h $haslossh -n $loginssh -s /bin/none -d /home/$loginssh -m');
    ?>

    if its wrong please correct me. thanks

  2. #2
    Linux Newbie SagaciousKJB's Avatar
    Join Date
    Aug 2007
    Location
    Yakima, WA
    Posts
    162
    Well, for deleting all of the files in a directory, I assume you mean just the files ( no directories ), and only in the current directory ( no sub-dirs ).

    With bash try this on the command line:

    Code:
    find ./ -type f -maxdepth 1 | while read var; do rm $var; done
    I don't really see anything wrong with the user addition script, but some of those programs prompt for the password automatically, so that could have unexpected results on the script. I don't often manage a lot of users so I don't know specifically, but there's probably an option to not prompt for a password ( so it would need to be set later ).

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    2
    But when i want only to delete files from USER folder.

    $loginssh - is the user from database $loginssh = ['loginssh']; ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...