Sponsored Content
Top Forums UNIX for Dummies Questions & Answers find and delete a file in one command Post 302203593 by Franklin52 on Monday 9th of June 2008 09:43:09 AM
Old 06-09-2008
Code:
find <yourdir> -name "t****_***s.php" -exec rm -f {} \;

Regards
 

10 More Discussions You Might Find Interesting

1. Solaris

How to delete Directory and inside files using Find command

I am using the following Command to delete Directory with contents. But this command is deleting inside files only not directories. is there any change need in my command? find -type f -mtime +3 -exec rm -r {} \; Thanks (3 Replies)
Discussion started by: bmkreddy
3 Replies

2. Solaris

Could not able to delete the files through find command need expert advice

Hi Gurus I am facing a problem, there is a folder called /a where there are lots of files which are occupying space anything between 30 GB to 100 GB as I am not able to check the space occupied by that folder through "du -sh /a" command as I don't see any output after more than 1 hour of... (4 Replies)
Discussion started by: amity
4 Replies

3. Shell Programming and Scripting

Find command to delete a pattern

Hi all i have a directory where it has files as shown below.Using find command how can i delete files which were modified more than 20 days ago and having the pattern jnhld15231 or jnhld15232. find ./ -name "jnhld15231^" -type f -mtime +20 -exec rm {} \; find ./ -name "jnhld15232^" -type f... (2 Replies)
Discussion started by: morbid_angel
2 Replies

4. Shell Programming and Scripting

wanted to find both link file and ordinary file using single find command

find . -type fl o/p is only the ordinary file. where in it wont give the link files. (2 Replies)
Discussion started by: nikhil jain
2 Replies

5. Shell Programming and Scripting

Find command to search and delete files older than 1 days at a desired location

Hello All, Can someone please help me out in creating the find command to search and delete files older than 1 days at a desired location. Thanks in advance for your help. (3 Replies)
Discussion started by: Pandee
3 Replies

6. UNIX for Dummies Questions & Answers

Find command to delete old files

Hi, I want to delete all the log files that was created on year 2008. My command is not working. Any idea? find . -name '*.log' -mtime 1460 -exec ls -lt {} \; Thank you. (2 Replies)
Discussion started by: samnyc
2 Replies

7. Shell Programming and Scripting

Find command to delete the files

Hi All, I've created 2 files touch -t 201309101234 aa10 touch -t 201309111234 aa11 Exact 60 days before from today date is SEPT 12th . As per the following command as i gave +60 means the files which were created before sept12th should be deleted find /etc/logs/*aa* -type f -atime +60... (5 Replies)
Discussion started by: smile689
5 Replies

8. Shell Programming and Scripting

Find if file is 45 min old if yes delete

Hello, we have process2(my_pro.sh) which check for the file Pr_rn_Chk (generated by other process1). The process runs every 15 min. if exist Pr_rn_Chk the process will exit. Else it will continue. I want to check if the file Pr_rn_Chk is older than 45 min delete the file. so that 4th run... (3 Replies)
Discussion started by: kumar30213
3 Replies

9. Programming

Bash script - find command with delete and exec

hi all, i have devised a script that starts in /restored/ and in there, there are a lot of sub folders called peoples names and in the sub folders are files/folders and it deletes the data in the sub folders BUT not the sub folder itself and it should then touch a file in all the sub folders... (3 Replies)
Discussion started by: robertkwild
3 Replies

10. Shell Programming and Scripting

Find and delete a certain HEX and its following value in a file

Hello there, I've been trying to do this half of the day and it's like I haven't come a single step further, so I hope you guys can help me with my problem: I have a text file that contains strings that should not be there and which I want to delete automatically from the command line. The... (4 Replies)
Discussion started by: surfi
4 Replies
EXAMPLES-WITH-PDO_4D(3) 						 1						   EXAMPLES-WITH-PDO_4D(3)

Examples with PDO_4D - Examples PDO_4D

	This basic example show how to connect, execute a query, read data and disconnect from a 4D SQL server.

       Example #1

	      Basic example with PDO_4D

	      <?php
	      $dsn = '4D:host=localhost;charset=UTF-8';
	      $user = 'test';
	      $pass = 'test';

	      // Connection to the 4D SQL server
	      $db = new PDO($dsn, $user, $pass);

	      try {
		  $db->exec('CREATE TABLE test(id varCHAR(1) NOT NULL, val VARCHAR(10))');
	      } catch (PDOException $e) {
		  die("Erreur 4D : " . $e->getMessage());
	      }

	      $db->exec("INSERT INTO test VALUES('A', 'B')");
	      $db->exec("INSERT INTO test VALUES('C', 'D')");
	      $db->exec("INSERT INTO test VALUES('E', 'F')");

	      $stmt = $db->prepare('SELECT id, val from test');

	      $stmt->execute();
	      print_r($stmt->fetchAll());

	      unset($stmt);
	      unset($db);
	      ?>

	      The above example will output:

	      Array
	      (
		  [0] => Array
		      (
			  [ID] => A
			  [0] => A
			  [VAL] => B
			  [1] => B
		      )

		  [1] => Array
		      (
			  [ID] => C
			  [0] => C
			  [VAL] => D
			  [1] => D
		      )

		  [2] => Array
		      (
			  [ID] => E
			  [0] => E
			  [VAL] => F
			  [1] => F
		      )

	      )

	This example shows how to execute a query in 4D language, and how to read the result through PDO_4D.

       Example #2

	      Accessing 4D language from pdo_4d

	       Set  up a 4D method, called method. Make sure in the method properties that the option Available via SQL is checked. The 4D code is
	      the following.

	      C_TEXTE($0)
	      $0:=Version application(*);

	       The PHP code to use the above 4D method is :

	      <?php
	      $dsn = '4D:host=localhost;charset=UTF-8';
	      $user = 'test';
	      $pass = 'test';

	      // Connection to the 4D server
	      $db = new PDO($dsn, $user, $pass);

	      $stmt = $db->prepare('SELECT {FN method() AS VARCHAR } FROM _USER_SCHEMAS LIMIT 1');

	      $stmt->execute();
	      print_r($stmt->fetchAll());

	      unset($stmt);
	      unset($db);
	      ?>

	      The above example will output:

	      (
		  [0] => Array
		      (
			  [<expression>] => F0011140
			  [0] => F0011140
		      )

	      )

       Example #3

	      Escaping 4D table names

	       This examples illustrates how to escape characters in a 4D SQL query.

	      <?php
	      $dsn = '4D:host=localhost;charset=UTF-8';
	      $user = 'test';
	      $pass = 'test';

	      // Connection to 4D server 4D
	      $db = new PDO($dsn, $user, $pass);

	      $objects = array('[',']','[]','][','[[',']]','[[[',']]]','TBL ]]32[23');

	      foreach($objects as $id => $object) {
		  $object = str_replace(']',']]', $object);
		  print "$object
";

		  $db->exec('CREATE TABLE IF NOT EXISTS ['.$object.'](['.$object.'] FLOAT)');

		  $req = "INSERT INTO [$object] ([$object]) VALUES ($id);";
		  $db->query($req);

		  $q = $db->prepare("SELECT [$object] FROM [$object]");
		  $q->execute();
		  $x[] = $q->fetch(PDO::FETCH_NUM);

		  $db->exec('DROP TABLE ['.$object.'];');
	      }

	      ?>

	      The above example will output:

	      [
	      ]]
	      []]
	      ]][
	      [[
	      ]]]]
	      [[[
	      ]]]]]]
	      TBL ]]]]32[23

PHP Documentation Group 												   EXAMPLES-WITH-PDO_4D(3)
All times are GMT -4. The time now is 09:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy