0

I have 2 files:
images1.txt
--file1
--file2
--file5
--file6
--file7
images2.txt
--file1
--file5
--file6

I need to be created file images_to_delete.txt with expected result:
images_to_delete.txt
--file2
--file7

I know i could do this with bash using command:

awk 'NR==FNR{a[$0];next}!($0 in a)' images2.txt images1.txt > images_to_delete.txt

Is there any possibility to do this in PHP without using shell_exec?

Thank you.

Kent
  • 189,393
  • 32
  • 233
  • 301
kostya572
  • 169
  • 2
  • 21

1 Answers1

0

By using these :

read files into an array file function

get difference between two arrays array_diff function

Community
  • 1
  • 1
nicolas
  • 712
  • 4
  • 15